From b3f8165d9add796076f8195d692851ad42e7e8a7 Mon Sep 17 00:00:00 2001 From: Teresa Ho Date: Thu, 17 Jan 2019 12:39:46 -0500 Subject: [PATCH] Handle config file without cluster network If the cluster host network is not specified in the config file for config_controller, the cluster host parameters are set to the defaults. Story: 2004273 Task: 27826 Change-Id: I20f22dc38a55312485e1d2b9c0e728d927b804c6 Signed-off-by: Teresa Ho --- .../controllerconfig/configassistant.py | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/controllerconfig/controllerconfig/controllerconfig/configassistant.py b/controllerconfig/controllerconfig/controllerconfig/configassistant.py index ba93e26590..1a224ba90c 100644 --- a/controllerconfig/controllerconfig/controllerconfig/configassistant.py +++ b/controllerconfig/controllerconfig/controllerconfig/configassistant.py @@ -3007,28 +3007,33 @@ class ConfigAssistant(): # Cluster network configuration if self.kubernetes: - self.cluster_host_interface_name = config.get( - 'cCLUSTER', 'CLUSTER_INTERFACE_NAME') - self.cluster_host_interface = config.get( - 'cCLUSTER', 'CLUSTER_INTERFACE') - self.cluster_host_mtu = config.get( - 'cCLUSTER', 'CLUSTER_MTU') - self.cluster_host_vlan = '' - if config.has_option('cCLUSTER', 'CLUSTER_VLAN'): - cvalue = config.get('cCLUSTER', 'CLUSTER_VLAN') - if cvalue != 'NC': - self.cluster_host_vlan = cvalue - self.lag_cluster_host_interface = config.getboolean( - 'cCLUSTER', 'LAG_CLUSTER_INTERFACE') - if self.lag_cluster_host_interface: - self.lag_cluster_host_interface_member0 = config.get( - 'cCLUSTER', 'CLUSTER_BOND_MEMBER_0') - self.lag_cluster_host_interface_member1 = config.get( - 'cCLUSTER', 'CLUSTER_BOND_MEMBER_1') - self.lag_cluster_host_interface_policy = config.get( - 'cCLUSTER', 'CLUSTER_BOND_POLICY') - self.cluster_host_subnet = IPNetwork(config.get( - 'cCLUSTER', 'CLUSTER_SUBNET')) + if config.has_section('cCLUSTER'): + self.cluster_host_interface_name = config.get( + 'cCLUSTER', 'CLUSTER_INTERFACE_NAME') + self.cluster_host_interface = config.get( + 'cCLUSTER', 'CLUSTER_INTERFACE') + self.cluster_host_mtu = config.get( + 'cCLUSTER', 'CLUSTER_MTU') + self.cluster_host_vlan = '' + if config.has_option('cCLUSTER', 'CLUSTER_VLAN'): + cvalue = config.get('cCLUSTER', 'CLUSTER_VLAN') + if cvalue != 'NC': + self.cluster_host_vlan = cvalue + self.lag_cluster_host_interface = config.getboolean( + 'cCLUSTER', 'LAG_CLUSTER_INTERFACE') + if self.lag_cluster_host_interface: + self.lag_cluster_host_interface_member0 = config.get( + 'cCLUSTER', 'CLUSTER_BOND_MEMBER_0') + self.lag_cluster_host_interface_member1 = config.get( + 'cCLUSTER', 'CLUSTER_BOND_MEMBER_1') + self.lag_cluster_host_interface_policy = config.get( + 'cCLUSTER', 'CLUSTER_BOND_POLICY') + self.cluster_host_subnet = IPNetwork(config.get( + 'cCLUSTER', 'CLUSTER_SUBNET')) + else: + self.cluster_host_interface_name = \ + self.management_interface_name + self.cluster_host_interface = self.management_interface self.cluster_host_interface_configured = True # External OAM network configuration