Skip to content

Commit

Permalink
Merge pull request #60 from dirgim/fix-cleanup-bug
Browse files Browse the repository at this point in the history
Fix backslash escaping for failed build cleanup filters
  • Loading branch information
arilivigni authored Jun 29, 2018
2 parents c3444a0 + 27dd344 commit 847b7d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions playbooks/roles/os_temps/tasks/handle_os_templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

# Check for failed apps and cleanup
- name: "Check for all failed apps on the cluster"
shell: "{{ oc_bin }} get all | egrep 'Failed|Error' | egrep 'builds\/' | awk '{print $1}' | awk -F'/' '{print $2}' | sed 's/-[0-9+]//g' "
shell: "{{ oc_bin }} get all | egrep 'Failed|Error' | egrep 'builds\\/' | awk '{print $1}' | awk -F'/' '{print $2}' | sed 's/-[0-9+]//g' "
register: oc_check_app_status
ignore_errors: yes
when: total_build_success|bool == false

- name: "Cleanup all failed dc, bc, routes, svc, and imagestreams on the cluster"
shell: "{{ oc_bin }} get all | grep '{{ failed_container_name }}' | awk '{print $1}' | egrep -v 'builds\/|po\/' | xargs -i {{ oc_bin }} delete {}"
shell: "{{ oc_bin }} get all | grep '{{ failed_container_name }}' | awk '{print $1}' | egrep -v 'builds\\/|po\\/' | xargs -i {{ oc_bin }} delete {}"
with_items: "{{ oc_check_app_status.stdout_lines }}"
loop_control:
loop_var: failed_container_name
Expand Down
4 changes: 2 additions & 2 deletions playbooks/roles/os_temps/tasks/setup_containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@

# Check for failed apps and cleanup
- name: "Check for all failed apps on the cluster"
shell: "{{ oc_bin }} get all | egrep 'Failed|Error' | egrep 'builds\/' | awk '{print $1}' | awk -F'/' '{print $2}' | sed 's/-[0-9+]//g' "
shell: "{{ oc_bin }} get all | egrep 'Failed|Error' | egrep 'builds\\/' | awk '{print $1}' | awk -F'/' '{print $2}' | sed 's/-[0-9+]//g' "
register: oc_check_app_status
ignore_errors: yes

- name: "Cleanup all failed dc, bc, routes, svc, and imagestreams on the cluster"
shell: "{{ oc_bin }} get all | grep '{{ failed_container_name }}' | awk '{print $1}' | egrep -v 'builds\/|po\/' | xargs -i {{ oc_bin }} delete {}"
shell: "{{ oc_bin }} get all | grep '{{ failed_container_name }}' | awk '{print $1}' | egrep -v 'builds\\/|po\\/' | xargs -i {{ oc_bin }} delete {}"
with_items: "{{ oc_check_app_status.stdout_lines }}"
loop_control:
loop_var: failed_container_name
Expand Down

0 comments on commit 847b7d6

Please sign in to comment.