diff options
author | Scott Dodson <sdodson@redhat.com> | 2017-03-20 13:17:24 -0400 |
---|---|---|
committer | Scott Dodson <sdodson@redhat.com> | 2017-03-20 14:00:20 -0400 |
commit | 6aee40fc1fab324134f4a28c2b124ba58e83932a (patch) | |
tree | 46800aadaa32e552ed59b111d6dc0b849e0bdc1a /roles | |
parent | 4b0fa927ae262a09da87c72ced250c1b3e9c91ae (diff) | |
download | openshift-6aee40fc1fab324134f4a28c2b124ba58e83932a.tar.gz openshift-6aee40fc1fab324134f4a28c2b124ba58e83932a.tar.bz2 openshift-6aee40fc1fab324134f4a28c2b124ba58e83932a.tar.xz openshift-6aee40fc1fab324134f4a28c2b124ba58e83932a.zip |
Protect against missing commands
Rather than trying to keep track of state everywhere, lets just check
to see if the command exist before we attempt to run them
Diffstat (limited to 'roles')
-rw-r--r-- | roles/openshift_excluder/tasks/exclude.yml | 12 | ||||
-rw-r--r-- | roles/openshift_excluder/tasks/unexclude.yml | 11 |
2 files changed, 23 insertions, 0 deletions
diff --git a/roles/openshift_excluder/tasks/exclude.yml b/roles/openshift_excluder/tasks/exclude.yml index 293a54184..ca18d343f 100644 --- a/roles/openshift_excluder/tasks/exclude.yml +++ b/roles/openshift_excluder/tasks/exclude.yml @@ -3,16 +3,28 @@ # - exclude_docker_excluder # - exclude_openshift_excluder - block: + + - name: Check for docker-excluder + stat: + path: /sbin/{{ openshift.common.service_type }}-docker-excluder + register: docker_excluder_stat - name: Enable docker excluder command: "{{ openshift.common.service_type }}-docker-excluder exclude" when: - exclude_docker_excluder | default(false) | bool + - docker_excluder_stat.stat.exists + - name: Check for openshift excluder + stat: + path: /sbin/{{ openshift.common.service_type }}-excluder + register: openshift_excluder_stat - name: Enable openshift excluder command: "{{ openshift.common.service_type }}-excluder exclude" # if the openshift override is set, it means the openshift excluder is disabled no matter what # if the openshift override is not set, the excluder is set based on enable_openshift_excluder when: - exclude_openshift_excluder | default(false) | bool + - openshift_excluder_stat.stat.exists + when: - not openshift.common.is_atomic | bool diff --git a/roles/openshift_excluder/tasks/unexclude.yml b/roles/openshift_excluder/tasks/unexclude.yml index 9112adbac..4df7f14b4 100644 --- a/roles/openshift_excluder/tasks/unexclude.yml +++ b/roles/openshift_excluder/tasks/unexclude.yml @@ -3,15 +3,26 @@ # - unexclude_docker_excluder # - unexclude_openshift_excluder - block: + + - name: Check for docker-excluder + stat: + path: /sbin/{{ openshift.common.service_type }}-docker-excluder + register: docker_excluder_stat - name: disable docker excluder command: "{{ openshift.common.service_type }}-docker-excluder unexclude" when: - unexclude_docker_excluder | default(false) | bool + - docker_excluder_stat.stat.exists + - name: Check for openshift excluder + stat: + path: /sbin/{{ openshift.common.service_type }}-excluder + register: openshift_excluder_stat - name: disable openshift excluder command: "{{ openshift.common.service_type }}-excluder unexclude" when: - unexclude_openshift_excluder | default(false) | bool + - openshift_excluder_stat.stat.exists when: - not openshift.common.is_atomic | bool |