Forráskód Böngészése

Updating oc_apply to use command instead of shell

ewolinetz 8 éve
szülő
commit
f6c5d4ca41
1 módosított fájl, 7 hozzáadás és 5 törlés
  1. 7 5
      roles/openshift_logging/tasks/oc_apply.yaml

+ 7 - 5
roles/openshift_logging/tasks/oc_apply.yaml

@@ -1,12 +1,13 @@
 ---
 ---
 - name: Checking generation of {{file_content.kind}} {{file_content.metadata.name}}
 - name: Checking generation of {{file_content.kind}} {{file_content.metadata.name}}
-  shell: >
+  command: >
     {{ openshift.common.client_binary }}
     {{ openshift.common.client_binary }}
     --config={{ kubeconfig }}
     --config={{ kubeconfig }}
     get {{file_content.kind}} {{file_content.metadata.name}}
     get {{file_content.kind}} {{file_content.metadata.name}}
     -o jsonpath='{.metadata.resourceVersion}'
     -o jsonpath='{.metadata.resourceVersion}'
-    -n {{namespace}} || echo 0
+    -n {{namespace}}
   register: generation_init
   register: generation_init
+  failed_when: "'not found' not in generation_init.stderr and generation_init.stdout == ''"
   changed_when: no
   changed_when: no
 
 
 - name: Applying {{file_name}}
 - name: Applying {{file_name}}
@@ -19,13 +20,14 @@
   changed_when: no
   changed_when: no
 
 
 - name: Determine change status of {{file_content.kind}} {{file_content.metadata.name}}
 - name: Determine change status of {{file_content.kind}} {{file_content.metadata.name}}
-  shell: >
+  command: >
     {{ openshift.common.client_binary }} --config={{ kubeconfig }}
     {{ openshift.common.client_binary }} --config={{ kubeconfig }}
     get {{file_content.kind}} {{file_content.metadata.name}}
     get {{file_content.kind}} {{file_content.metadata.name}}
     -o jsonpath='{.metadata.resourceVersion}'
     -o jsonpath='{.metadata.resourceVersion}'
-    -n {{namespace}} || echo 0
+    -n {{namespace}}
   register: generation_changed
   register: generation_changed
-  changed_when: generation_changed.stdout | int  > generation_init.stdout | int
+  failed_when: "'not found' not in generation_changed.stderr and generation_changed.stdout == ''"
+  changed_when: generation_changed.stdout | default (0) | int  > generation_init.stdout | default(0) | int
   when:
   when:
     - "'field is immutable' not in generation_apply.stderr"
     - "'field is immutable' not in generation_apply.stderr"