Fix to check the result of undercloud_debug validation
undercloud_debug validation always fails because the playbook doesn't check config_result correctly. The structure of config_result is like as follows: "changed": false, "msg": "All items completed", "results": [ { "ansible_loop_var": "item", "changed": false, "failed": false, "invocation": { "module_args": { "default": null, "ignore_missing_file": true, "key": "debug", "path": "/var/lib/config-data/puppet-generated/neutron/etc/neutron/neutron.conf", "section": "DEFAULT" } }, "item": "/var/lib/config-data/puppet-generated/neutron/etc/neutron/neutron.conf", "msg": "The key 'debug' under the section 'DEFAULT' in file /var/lib/config-data/puppet-generated/neutron/etc/neutron/neutron.conf has the value: 'True'", "value": "True" }, ... Fix the playbook to see confi_result structure correctly. Change-Id: I8fb6167f62ae7252f6f57249a30b74f5679115d3
This commit is contained in:
parent
48c52d9f68
commit
f933d7f02f
@ -35,12 +35,14 @@
|
||||
include_role:
|
||||
name: undercloud_debug
|
||||
vars:
|
||||
debug_check: false
|
||||
debug_check: true
|
||||
|
||||
- name: Should fail due to bad value
|
||||
block:
|
||||
- include_role:
|
||||
name: undercloud_debug
|
||||
vars:
|
||||
debug_check: false
|
||||
|
||||
rescue:
|
||||
- name: Clear host errors
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
- name: Check the services for debug flag
|
||||
- name: Get the services for debug flag
|
||||
become: true
|
||||
validations_read_ini:
|
||||
path: "{{ item }}"
|
||||
@ -8,4 +8,10 @@
|
||||
ignore_missing_file: true
|
||||
register: config_result
|
||||
with_items: "{{ services_conf_files }}"
|
||||
failed_when: "debug_check|bool == config_result.value|bool"
|
||||
|
||||
- name: Check the services for debug flag
|
||||
fail:
|
||||
msg: >
|
||||
debug_check is set to {{ debug_check }} and the result of
|
||||
validation is {{ config_result.results[0].value }}
|
||||
failed_when: "debug_check|bool != config_result.results[0].value|bool"
|
||||
|
Loading…
Reference in New Issue
Block a user