From: Sébastien Han Date: Fri, 27 Jan 2017 10:21:04 +0000 (+0100) Subject: purge: allow purge to run multiple times X-Git-Tag: v2.1.5~1^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=15b89984aa39402e3284260a67c6cf01668ef9cd;p=ceph-ansible.git 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 (cherry picked from commit 0e2e270ab238f63285422fed90fc773d9e4ae0be) --- diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index 8fd30dfda..1637d7edc 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -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