From 89463939f288063d0fb031c551ffc7a463779e65 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Han?= Date: Fri, 12 Oct 2018 18:32:40 +0200 Subject: [PATCH] validate: only check device when they are devices MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We only validate the devices that are passed if there is a list of devices to validate. Signed-off-by: Sébastien Han (cherry picked from commit 2888c0825fe11176d3cd06fe3568fe340d6d6538) --- roles/ceph-validate/tasks/check_devices.yml | 9 +++++---- roles/ceph-validate/tasks/main.yml | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/roles/ceph-validate/tasks/check_devices.yml b/roles/ceph-validate/tasks/check_devices.yml index a8122021c..f196e34fc 100644 --- a/roles/ceph-validate/tasks/check_devices.yml +++ b/roles/ceph-validate/tasks/check_devices.yml @@ -24,19 +24,20 @@ register: dedicated_device_parted with_items: "{{ dedicated_devices }}" when: - - osd_scenario == 'non-collocated' + - dedicated_devices|default([]) | length > 0 - name: fail if one of the dedicated_device is not a device fail: msg: "{{ item }} is not a block special file!" with_items: "{{ dedicated_device_parted.results }}" when: - - osd_scenario == 'non-collocated' + - dedicated_devices|default([]) | length > 0 - item.failed - name: fail if number of dedicated_devices is not equal to number of devices fail: msg: "Number of dedicated_devices must be equal to number of devices. dedicated_devices: {{ dedicated_devices | length }}, devices: {{ devices | length }}" when: - - osd_scenario == 'non-collocated' - - dedicated_devices|length != devices|length + - dedicated_devices|default([]) | length > 0 + - devices | length > 0 + - dedicated_devices | length != devices | length \ No newline at end of file diff --git a/roles/ceph-validate/tasks/main.yml b/roles/ceph-validate/tasks/main.yml index 1a5a7f757..a84c98b9c 100644 --- a/roles/ceph-validate/tasks/main.yml +++ b/roles/ceph-validate/tasks/main.yml @@ -61,6 +61,7 @@ when: - osd_group_name in group_names - not osd_auto_discovery | default(False) + - devices|default([])|length > 0 - name: include check_eth_mon.yml include_tasks: check_eth_mon.yml -- 2.39.5