Skip to content

Commit

Permalink
Merge pull request #57 from yontalcar/tests_get_disks
Browse files Browse the repository at this point in the history
Fail if there are not enough disks for testing
  • Loading branch information
pcahyna authored Jan 14, 2020
2 parents b5889c3 + 4b1d9d5 commit 2d5dccd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
10 changes: 4 additions & 6 deletions tests/get_unused_disk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
unused_disks: "{{ unused_disks_return.disks }}"
when: "'Unable to find unused disk' not in unused_disks_return.disks"

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

- name: Print unused disks
debug:
Expand Down
8 changes: 1 addition & 7 deletions tests/tests_lvm_multiple_disks_multiple_volumes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@
vars:
min_size: "{{ volume_group_size }}"
max_return: 2

- block:
- debug:
msg: "There needs to be two unused disks in the system to run this playbook."
- name: End playbook if there isn't two disks available
meta: end_play
when: unused_disks|length < 2
disks_needed: 2

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

0 comments on commit 2d5dccd

Please sign in to comment.