osd: fail check mount partition if not skipped

We forgot to handle the case where "check if any of the raw partitions
are mounted" task gets skipped.

Signed-off-by: Sébastien Han <seb@redhat.com>
pull/1723/head
Sébastien Han 2017-07-27 11:39:19 +02:00
parent fb4254b7e5
commit 63cbcc8260
1 changed files with 8 additions and 6 deletions

View File

@ -8,7 +8,7 @@
register: ispartition_results register: ispartition_results
when: when:
- ansible_devices is defined - ansible_devices is defined
- item.value.removable == "0" - item.value.removable == 0
- name: check if any of the raw partitions are mounted - name: check if any of the raw partitions are mounted
shell: "mount |grep -sq '^/dev/{{ item.key }} '" shell: "mount |grep -sq '^/dev/{{ item.key }} '"
@ -21,15 +21,17 @@
always_run: true always_run: true
when: when:
- ansible_devices is defined - ansible_devices is defined
- item.value.removable == "0" - item.value.removable == 0
- item.value.partitions|count == 0 - item.value.partitions|count == 0
- item.value.holders|count == 0 - item.value.holders|count == 0
- name: fail if any of the raw partitions are mounted - name: fail if any of the raw partitions are mounted
fail: fail:
msg: "OSD device autodetection failed because one or more raw partitions is mounted on the host." msg: "OSD device autodetection failed because one or more raw partitions is mounted on the host."
when: item.rc == 0
with_items: "{{ mount_cmd.results }}" with_items: "{{ mount_cmd.results }}"
when:
- item.rc == 0
- not item.get("skipped")
- name: check the partition status of the osd disks (autodiscover disks) - name: check the partition status of the osd disks (autodiscover disks)
shell: "parted --script /dev/{{ item.key }} print > /dev/null 2>&1" shell: "parted --script /dev/{{ item.key }} print > /dev/null 2>&1"
@ -40,7 +42,7 @@
register: osd_partition_status_results register: osd_partition_status_results
when: when:
- ansible_devices is defined - ansible_devices is defined
- item.value.removable == "0" - item.value.removable == 0
- item.value.partitions|count == 0 - item.value.partitions|count == 0
- item.value.holders|count == 0 - item.value.holders|count == 0
@ -52,7 +54,7 @@
changed_when: false changed_when: false
when: when:
- ansible_devices is defined - ansible_devices is defined
- item.0.item.value.removable == "0" - item.0.item.value.removable == 0
- item.0.item.value.partitions|count == 0 - item.0.item.value.partitions|count == 0
- item.0.item.value.holders|count == 0 - item.0.item.value.holders|count == 0
- item.0.rc != 0 - item.0.rc != 0
@ -66,4 +68,4 @@
register: parted_results register: parted_results
when: when:
- ansible_devices is defined - ansible_devices is defined
- item.value.removable == "0" - item.value.removable == 0