]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
purge: allow purge to run multiple times
authorSébastien Han <seb@redhat.com>
Fri, 27 Jan 2017 10:21:04 +0000 (11:21 +0100)
committerSébastien Han <seb@redhat.com>
Mon, 30 Jan 2017 13:31:56 +0000 (14:31 +0100)
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>
infrastructure-playbooks/purge-cluster.yml

index 70a3893dd3884131ee0c867b2a955b07f8d923c6..0de3f002e167c4309519c3dbb1d68a8888537592 100644 (file)
       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