Fix diskspace validation when size is the limit

Previously if you had 25.5G free and the minimum should be 25, the task
would fail. We do not want to fail when the amount of space free is
equal to the minimum required space. We only want to fail when it's less
than the required space. In this case the task needs to be updated to
drop the equals from the failed_when so that if the amount free is equal
to the minimum required amount then it will pass.

Change-Id: I90b4a9617ba00610bee77af84bb1d12511ad452f
Closes-Bug: #1793211
(cherry picked from commit 8a7fa0d712)
This commit is contained in:
Alex Schultz 2018-09-18 17:37:12 -06:00
parent fbfd25388e
commit 26d59879e3
1 changed files with 2 additions and 2 deletions

View File

@ -13,8 +13,8 @@
- name: loop on existing volumes, check available space
fail:
msg: "Minimum required for {{ item.mount }}: {{ volumes | selectattr('mount', 'equalto', item.mount) | map(attribute='min_size') | list | join('') }}G - volume free space: {{ (item.size_available|int / const_bytes_in_gb|int) |round(1) }}"
failed_when: "(volumes | selectattr('mount', 'equalto', item.mount) | map(attribute='min_size') | list | join('')|int) >= (item.size_available|int / const_bytes_in_gb|int) |int"
msg: "Minimum required for {{ item.mount }}: {{ volumes | selectattr('mount', 'equalto', item.mount) | map(attribute='min_size') | list | join('') }}G - volume free space: {{ (item.size_available|int / const_bytes_in_gb|int) |round(1) }}G"
failed_when: "(volumes | selectattr('mount', 'equalto', item.mount) | map(attribute='min_size') | list | join('')|int) > (item.size_available|int / const_bytes_in_gb|int) |int"
loop: "{{ a_mounts }}"
loop_control:
label: "{{ item.mount }}"