]> git-server-git.apps.pok.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)
committerAndrew Schoen <aschoen@redhat.com>
Tue, 31 Jan 2017 13:35:00 +0000 (07:35 -0600)
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>
(cherry picked from commit 0e2e270ab238f63285422fed90fc773d9e4ae0be)

infrastructure-playbooks/purge-cluster.yml

index 8fd30dfdaf4ff23017c3b30f347204bd76cf907b..1637d7edc30b39070be94962365c331b75cc8127 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