Refactor vif plugging validations
It makes no sense to lump vif_plugging_timeout and vif_plugging_fatal
into the same tasks. One is a numeric value validated to be larger
than a minimum, the other is a boolean value validated to be set to
True. Split them into separate tasks, and clarify the failure error
messages.
Closes-Bug: #1901297
Related: rhbz#1891197
Change-Id: I7a28f6014c55293d018d5fbc3223a26a10550f1c
(cherry picked from commit ee19a57bc5
)
This commit is contained in:
parent
766ac4c93d
commit
bbc99b7aee
|
@ -1,24 +1,31 @@
|
||||||
---
|
---
|
||||||
- name: Get VIF Plugging setting values from nova.conf
|
- name: Get vif_plugging_fatal value from nova.conf
|
||||||
become: true
|
become: true
|
||||||
validations_read_ini:
|
validations_read_ini:
|
||||||
path: "{{ nova_config_file }}"
|
path: "{{ nova_config_file }}"
|
||||||
section: DEFAULT
|
section: DEFAULT
|
||||||
key: "{{ item }}"
|
key: "{{ vif_plugging_fatal_check }}"
|
||||||
ignore_missing_file: true
|
ignore_missing_file: true
|
||||||
register: nova_config_result
|
register: vif_plugging_fatal_value
|
||||||
with_items:
|
|
||||||
- "{{ vif_plugging_fatal_check }}"
|
|
||||||
- "{{ vif_plugging_timeout_check }}"
|
|
||||||
|
|
||||||
- name: Check Nova configuration values
|
- name: Get vif_plugging_timeout value from nova.conf
|
||||||
|
become: true
|
||||||
|
validations_read_ini:
|
||||||
|
path: "{{ nova_config_file }}"
|
||||||
|
section: DEFAULT
|
||||||
|
key: "{{ vif_plugging_timeout_check }}"
|
||||||
|
ignore_missing_file: true
|
||||||
|
register: vif_plugging_timeout_value
|
||||||
|
|
||||||
|
- name: Ensure vif plugging timeout minimum
|
||||||
fail:
|
fail:
|
||||||
msg: "Value of {{ item.item }} is set to {{ item.value or 'None' }}."
|
msg: "vif_plugging_timeout is below minimum value. Minimum: {{ vif_plugging_timeout_value_min|int }}. Current value: {{ vig_plugging_timeout_value }}"
|
||||||
when:
|
when: "{{ vif_plugging_timeout_value|int < vif_plugging_timeout_value_min|int }}"
|
||||||
- "(item.item == vif_plugging_fatal_check and (not item.value|bool or None)) or
|
|
||||||
(item.item == vif_plugging_timeout_check and (item.value|int <= vif_plugging_timeout_value_min|int
|
- name: Ensure vif plugging is fatal
|
||||||
or None))"
|
fail:
|
||||||
with_items: "{{ nova_config_result.results }}"
|
msg: "vif_plugging_fatal should be set to True. Current value: {{ vif_plugging_fatal_value }}."
|
||||||
|
when: "not {{ vif_plugging_fatal_value|bool }}"
|
||||||
|
|
||||||
- name: Get auth_url value from hiera
|
- name: Get auth_url value from hiera
|
||||||
become: true
|
become: true
|
||||||
|
|
Loading…
Reference in New Issue