prevent validations from failing when undercloud.conf is missing:

- check-network-gateway, ctlplane-iprange and dhcp-provisioning now don't fail when
  undercloud.conf is missing, they use default values for the validation instead
- module undercloud_conf.py has a new option ignore_missing which (if set to true)
  prevents the module from failing when undercloud.conf does not exist

Change-Id: I859f814f1bbeda267d7f39d27edce87a41126138
Closes-Bug: #1643810
This commit is contained in:
Katerina Pilatova 2016-12-05 18:23:09 +01:00
parent 2a92f61346
commit c27c9e6b39
4 changed files with 13 additions and 3 deletions

View File

@ -14,7 +14,9 @@
hiera: name="tripleo_undercloud_conf_file"
- name: Gather undercloud.conf values
become: true
undercloud_conf: undercloud_conf_path={{ tripleo_undercloud_conf_file }}
undercloud_conf:
undercloud_conf_path={{ tripleo_undercloud_conf_file }}
ignore_missing=true
- name: "Test network_gateway if different from local_ip"
icmp_ping: host={{ undercloud_conf.DEFAULT.network_gateway }}
when: >

View File

@ -15,7 +15,9 @@
hiera: name="tripleo_undercloud_conf_file"
- name: Gather undercloud.conf values
become: true
undercloud_conf: undercloud_conf_path={{ tripleo_undercloud_conf_file }}
undercloud_conf:
undercloud_conf_path={{ tripleo_undercloud_conf_file }}
ignore_missing=true
- name: Check the size of the DHCP range for overcloud nodes
ip_range:
start: "{{ undercloud_conf.DEFAULT.dhcp_start|default('192.0.2.5') }}"

View File

@ -17,7 +17,9 @@
- name: Get the path of tripleo undercloud config file
hiera: name="tripleo_undercloud_conf_file"
- name: Gather undercloud.conf values
undercloud_conf: undercloud_conf_path={{ tripleo_undercloud_conf_file }}
undercloud_conf:
undercloud_conf_path={{ tripleo_undercloud_conf_file }}
ignore_missing=true
- name: Install python-virtualenv
package: name=python-virtualenv state=present
- name: Install scapy

View File

@ -23,6 +23,7 @@ from ansible.module_utils.basic import * # noqa
def main():
module = AnsibleModule(argument_spec=dict(
undercloud_conf_path=dict(required=True, type='str'),
ignore_missing=dict(type='bool'),
))
undercloud_conf_path = module.params.get('undercloud_conf_path')
@ -37,6 +38,9 @@ def main():
module.exit_json(changed=False,
ansible_facts={u'undercloud_conf': result})
elif module.params.get('ignore_missing'):
module.exit_json(changed=False,
ansible_facts={u'undercloud_conf': {'DEFAULT': {}}})
else:
module.fail_json(msg="Could not open the undercloud.conf file at '%s'"
% undercloud_conf_path)