]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
purge: fix lvm-batch purge osd
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 2 Apr 2019 08:43:01 +0000 (10:43 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 3 Apr 2019 06:48:39 +0000 (08:48 +0200)
`lvm_volumes` and/or `devices` variable(s) can be undefined depending on
the scenario chosen.

These tasks should be run only if these variable are defined, otherwise
it ends up with undefined variable errors.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1653307
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 01807383132c2897e331dcc665f062f8be0feeb8)

infrastructure-playbooks/purge-cluster.yml
infrastructure-playbooks/purge-docker-cluster.yml

index 0e28e0f9cfecfbcde802f1e94a90f883c859a279..7dd2401bb2e3482695b1660a6b066cbd2883bd98 100644 (file)
       CEPH_VOLUME_DEBUG: 1
     with_items: "{{ lvm_volumes }}"
     when:
+      - lvm_volumes | default([]) | length > 0
       - osd_scenario == "lvm"
       - ceph_volume_present.rc == 0
 
       CEPH_VOLUME_DEBUG: 1
     with_items: "{{ devices | default([]) }}"
     when:
+      - devices | default([]) | length > 0
       - osd_scenario == "lvm"
       - ceph_volume_present.rc == 0
 
index 3b886ddfd91ea3b2724a85e24eb5a645a8a66961..64d7f5fe211282e4c7eb2751719a05e0372c4673 100644 (file)
             CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
             CEPH_CONTAINER_BINARY: "docker"
           with_items: "{{ lvm_volumes }}"
+          when: lvm_volumes | default([]) | length > 0
 
         - name: zap and destroy osds created by ceph-volume with devices
           ceph_volume:
             CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
             CEPH_CONTAINER_BINARY: "docker"
           with_items: "{{ devices | default([]) }}"
+          when: devices | default([]) | length > 0
       when:
         - osd_scenario == "lvm"