summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2016-11-07 22:46:25 -0500
committerScott Dodson <sdodson@redhat.com>2016-11-07 22:48:54 -0500
commit44328048a46bdab718b7d0f27cfa405d994ed6d2 (patch)
tree79e88aace29ffa04cc08da085de66232a2a69267 /roles
parentf5f7937a89deceae5795987d2eeae26810499b99 (diff)
downloadopenshift-44328048a46bdab718b7d0f27cfa405d994ed6d2.tar.gz
openshift-44328048a46bdab718b7d0f27cfa405d994ed6d2.tar.bz2
openshift-44328048a46bdab718b7d0f27cfa405d994ed6d2.tar.xz
openshift-44328048a46bdab718b7d0f27cfa405d994ed6d2.zip
Refactor default sdn_cluster_network_cidr and sdn_host_subnet_length
Inventory values highest priority, then anything in master-config.yaml, then defaults last.
Diffstat (limited to 'roles')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py13
1 files changed, 9 insertions, 4 deletions
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']