From 773f06aa167727645b5d0bdd577034d4e8fc0295 Mon Sep 17 00:00:00 2001 From: agopi Date: Fri, 23 Jun 2017 17:53:08 -0400 Subject: [PATCH] Work around ansible issues using Browbeat-ML to classify pipeline builds 1. Fixed the bug where the browbeat_run.log file is empty. 2. UUID will now be grepped from the log file directly. Bypassing an ansible issue that made grepping it directly from the registered result impossible in specific situations. Change-Id: Icc0bfb18d0491622d523d30412674f2cd62e80e9 --- .../oooq/roles/browbeat-classify/files/uuid_extract.sh | 2 +- ansible/oooq/roles/browbeat-classify/tasks/main.yml | 8 +------- ansible/oooq/roles/browbeat-run/tasks/main.yml | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/ansible/oooq/roles/browbeat-classify/files/uuid_extract.sh b/ansible/oooq/roles/browbeat-classify/files/uuid_extract.sh index 37b070217..9001c9591 100644 --- a/ansible/oooq/roles/browbeat-classify/files/uuid_extract.sh +++ b/ansible/oooq/roles/browbeat-classify/files/uuid_extract.sh @@ -1,5 +1,5 @@ #!/bin/bash -grep -o 'UUID: [^,]*' /tmp/browbeatrun_log.log| tail -1 | grep -o ' [^,]*' | tr -d ' ' | sed 's/\x27/ /g' +grep -o 'UUID: [^,]*' $1 | tail -1 | grep -o ' [^,]*' | tr -d ' ' | sed 's/\x27/ /g' diff --git a/ansible/oooq/roles/browbeat-classify/tasks/main.yml b/ansible/oooq/roles/browbeat-classify/tasks/main.yml index 22d88e8be..21ee05dc7 100644 --- a/ansible/oooq/roles/browbeat-classify/tasks/main.yml +++ b/ansible/oooq/roles/browbeat-classify/tasks/main.yml @@ -1,15 +1,12 @@ --- -- name: Echo variable to browbeatrun_log.log - shell: "echo {{browbeatrun_log}} > /tmp/browbeatrun_log.log" - - name: Copy bash file copy: src: uuid_extract.sh dest: /tmp - name: Parse uuid from variable - shell: sh /tmp/uuid_extract.sh + shell: "sh /tmp/uuid_extract.sh {{ ansible_env.HOME }}/browbeat/results/browbeat_run.log" register: browbeat_uuid - name: Clone and Install Browbeat-ML dependencies @@ -17,9 +14,6 @@ name: "git+https://github.com/aakarshg/Browbeat-ML#egg=bml" virtualenv: "{{ ansible_env.HOME }}/browbeat-venv" -- name: Print uuid - debug: msg="{{browbeat_uuid.stdout}}" - - name: Run Browbeat-ML on uuid shell: "source {{ ansible_env.HOME }}/browbeat-venv/bin/activate; bml --summary-uuid {{browbeat_uuid.stdout}}" register: browbeatml_summary diff --git a/ansible/oooq/roles/browbeat-run/tasks/main.yml b/ansible/oooq/roles/browbeat-run/tasks/main.yml index c02254452..323e41ba8 100644 --- a/ansible/oooq/roles/browbeat-run/tasks/main.yml +++ b/ansible/oooq/roles/browbeat-run/tasks/main.yml @@ -4,5 +4,5 @@ shell: "source {{ ansible_env.HOME }}/browbeat-venv/bin/activate; \ cd {{ ansible_env.HOME }}/browbeat/; \ - python browbeat.py all | tee {{ ansible_env.HOME }}/browbeat/results/browbeat_run.log" - register: browbeatrun_log + python browbeat.py all |& tee {{ ansible_env.HOME }}/browbeat/results/browbeat_run.log" +