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 commitee19a57bc5
) (cherry picked from commitbbc99b7aee
)
This commit is contained in:
parent
6de842a4f4
commit
c8d92bc9c3
|
@ -1,24 +1,31 @@
|
|||
---
|
||||
- name: Get VIF Plugging setting values from nova.conf
|
||||
- name: Get vif_plugging_fatal value from nova.conf
|
||||
become: true
|
||||
validations_read_ini:
|
||||
path: "{{ nova_config_file }}"
|
||||
section: DEFAULT
|
||||
key: "{{ item }}"
|
||||
key: "{{ vif_plugging_fatal_check }}"
|
||||
ignore_missing_file: true
|
||||
register: nova_config_result
|
||||
with_items:
|
||||
- "{{ vif_plugging_fatal_check }}"
|
||||
- "{{ vif_plugging_timeout_check }}"
|
||||
register: vif_plugging_fatal_value
|
||||
|
||||
- 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:
|
||||
msg: "Value of {{ item.item }} is set to {{ item.value or 'None' }}."
|
||||
when:
|
||||
- "(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
|
||||
or None))"
|
||||
with_items: "{{ nova_config_result.results }}"
|
||||
msg: "vif_plugging_timeout is below minimum value. Minimum: {{ vif_plugging_timeout_value_min|int }}. Current value: {{ vig_plugging_timeout_value }}"
|
||||
when: "{{ vif_plugging_timeout_value|int < vif_plugging_timeout_value_min|int }}"
|
||||
|
||||
- name: Ensure vif plugging is fatal
|
||||
fail:
|
||||
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
|
||||
become: true
|
||||
|
|
Loading…
Reference in New Issue