Skip to content

Commit 2d5dccd

Browse files
authored
Merge pull request #57 from yontalcar/tests_get_disks
Fail if there are not enough disks for testing
2 parents b5889c3 + 4b1d9d5 commit 2d5dccd

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

tests/get_unused_disk.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
unused_disks: "{{ unused_disks_return.disks }}"
1010
when: "'Unable to find unused disk' not in unused_disks_return.disks"
1111

12-
- block:
13-
- name: Exit playbook when there's no unused disks in the system
14-
debug:
15-
msg: "Unable to find unused disks. Exiting playbook."
16-
- meta: end_play
17-
when: unused_disks is undefined
12+
- name: Exit playbook when there's not enough unused disks in the system
13+
fail:
14+
msg: "Unable to find enough unused disks. Exiting playbook."
15+
when: unused_disks is undefined or unused_disks|length < disks_needed|default(1)
1816

1917
- name: Print unused disks
2018
debug:

tests/tests_lvm_multiple_disks_multiple_volumes.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@
1515
vars:
1616
min_size: "{{ volume_group_size }}"
1717
max_return: 2
18-
19-
- block:
20-
- debug:
21-
msg: "There needs to be two unused disks in the system to run this playbook."
22-
- name: End playbook if there isn't two disks available
23-
meta: end_play
24-
when: unused_disks|length < 2
18+
disks_needed: 2
2519

2620
- name: Create a logical volume spanning two physical volumes that changes its mount location
2721
include_role:

0 commit comments

Comments
 (0)