From 44328048a46bdab718b7d0f27cfa405d994ed6d2 Mon Sep 17 00:00:00 2001 From: Scott Dodson Date: Mon, 7 Nov 2016 22:46:25 -0500 Subject: Refactor default sdn_cluster_network_cidr and sdn_host_subnet_length Inventory values highest priority, then anything in master-config.yaml, then defaults last. --- roles/openshift_facts/library/openshift_facts.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 769d11a42..c75b3c0c9 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -903,8 +903,8 @@ def set_sdn_facts_if_unset(facts, system_facts): if 'master' in facts: # set defaults for sdn_cluster_network_cidr and sdn_host_subnet_length # these might be overridden if they exist in the master config file - facts['master']['sdn_cluster_network_cidr'] = '10.128.0.0/14' - facts['master']['sdn_host_subnet_length'] = '9' + sdn_cluster_network_cidr = '10.128.0.0/14' + sdn_host_subnet_length = '9' master_cfg_path = os.path.join(facts['common']['config_base'], 'master/master-config.yaml') @@ -914,12 +914,17 @@ def set_sdn_facts_if_unset(facts, system_facts): if 'networkConfig' in config: if 'clusterNetworkCIDR' in config['networkConfig']: - facts['master']['sdn_cluster_network_cidr'] = \ + sdn_cluster_network_cidr = \ config['networkConfig']['clusterNetworkCIDR'] if 'hostSubnetLength' in config['networkConfig']: - facts['master']['sdn_host_subnet_length'] = \ + sdn_host_subnet_length = \ config['networkConfig']['hostSubnetLength'] + if 'sdn_cluster_network_cidr' not in facts['master']: + facts['master']['sdn_cluster_network_cidr'] = sdn_cluster_network_cidr + if 'sdn_host_subnet_length' not in facts['master']: + facts['master']['sdn_host_subnet_length'] = sdn_host_subnet_length + if 'node' in facts and 'sdn_mtu' not in facts['node']: node_ip = facts['common']['ip'] -- cgit v1.2.3