Skip to content

Commit

Permalink
validate: only check device when they are devices
Browse files Browse the repository at this point in the history
We only validate the devices that are passed if there is a list of
devices to validate.

Signed-off-by: Sébastien Han <seb@redhat.com>
  • Loading branch information
leseb authored and dsavineau committed Apr 11, 2019
1 parent 72211d4 commit 2888c08
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions roles/ceph-validate/tasks/check_devices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions roles/ceph-validate/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2888c08

Please sign in to comment.