purge: allow purge to run multiple times

with_items is evaluated before the when so in a second run where the
variable is empty if will fail with "'dict object' has no attribute
'stdout_lines'". To fix this we had a default array so with_items does
not fail and the task is skipped with the when.

Signed-off-by: Sébastien Han <seb@redhat.com>
pull/1254/head
Sébastien Han 2017-01-27 11:21:04 +01:00
parent 6f53774ee9
commit 0e2e270ab2
1 changed files with 1 additions and 1 deletions

View File

@ -436,7 +436,7 @@
raw_device=$(echo "{{ item }}" | egrep -o '/dev/([hsv]d[a-z]{1,2}|cciss/c[0-9]d[0-9]p|nvme[0-9]n[0-9]p){1,2}')
partition_nb=$(echo "{{ item }}" | egrep -o '[0-9]{1,2}$')
sgdisk --delete $partition_nb $raw_device
with_items: "{{ ceph_journal_partition_to_erase_path.stdout_lines }}"
with_items: "{{ ceph_journal_partition_to_erase_path.stdout_lines | default([]) }}"
when:
- ceph_journal_partlabels.rc == 0
- raw_multi_journal is defined