Skip to content

Commit

Permalink
add conditions to check if stdout or stdout_lines is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Payback159 authored Oct 10, 2024
1 parent 21c373d commit 7ba6750
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions roles/download/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
with_items: "{{ (node_images_raw.stdout | from_json).images }}"
when:
- image_command_tool == 'crictl'
- node_images_raw.stdout != ''
# In case of nerdctl or docker, the output is already in the expected format
# {"Digest":"sha256:847423221ed040798e47df36450edce5581ed642cd087ccb210532764da38b23","Repository":"quay.io/coreos/etcd","Tag":"v3.5.12"}
# {"Digest":"sha256:34fc87c4a60c0b3ba3b3608871f4494de8072c02808a4151953068f2d7c87743","Repository":"flannel/flannel","Tag":"latest"}
Expand All @@ -43,6 +44,7 @@
node_images: "{{ node_images_raw.stdout_lines | map('from_json') | list }}"
when:
- image_command_tool in ['nerdctl', 'docker']
- when node_images_raw.stdout_lines != ''

- name: Show node images
debug:
Expand Down

0 comments on commit 7ba6750

Please sign in to comment.