From 7136f1734e73726ee4468cca91715b425f8d6788 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 2 Apr 2019 10:43:01 +0200 Subject: [PATCH] purge: fix lvm-batch purge osd `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 (cherry picked from commit 01807383132c2897e331dcc665f062f8be0feeb8) --- infrastructure-playbooks/purge-cluster.yml | 2 ++ infrastructure-playbooks/purge-docker-cluster.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index 0e28e0f9c..7dd2401bb 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -323,6 +323,7 @@ CEPH_VOLUME_DEBUG: 1 with_items: "{{ lvm_volumes }}" when: + - lvm_volumes | default([]) | length > 0 - osd_scenario == "lvm" - ceph_volume_present.rc == 0 @@ -334,6 +335,7 @@ CEPH_VOLUME_DEBUG: 1 with_items: "{{ devices | default([]) }}" when: + - devices | default([]) | length > 0 - osd_scenario == "lvm" - ceph_volume_present.rc == 0 diff --git a/infrastructure-playbooks/purge-docker-cluster.yml b/infrastructure-playbooks/purge-docker-cluster.yml index 3b886ddfd..64d7f5fe2 100644 --- a/infrastructure-playbooks/purge-docker-cluster.yml +++ b/infrastructure-playbooks/purge-docker-cluster.yml @@ -465,6 +465,7 @@ 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: @@ -475,6 +476,7 @@ 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"