From 5c840c4941d8401ee3c2d15c9a6cfb4f6a074deb Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Tue, 23 May 2017 16:19:30 +0000 Subject: Continue bringing up interfaces even if one fails Currently os-net-config exits immediately if an interface fails to come up. This causes problems when we call it with a failsafe configuration because it can result in working interfaces not being configured if there are also non-functional interfaces, which can leave a system unreachable over the network even though it may have a working connection. This change stores errors and handles them after all interfaces have been processed to allow os-net-config to do what it can even with an invalid configuration. If any failures are detected it will still cause os-net-config to report failure at the end. Change-Id: I3bc75e217d0b7c5ae62900f4253ad57ee3720685 Closes-Bug: 1692725 --- os_net_config/impl_ifcfg.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'os_net_config/impl_ifcfg.py') diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py index 6f35688..d9d362d 100644 --- a/os_net_config/impl_ifcfg.py +++ b/os_net_config/impl_ifcfg.py @@ -1054,4 +1054,11 @@ class IfcfgNetConfig(os_net_config.NetConfig): logger.info('Updating VPP mapping') utils.update_vpp_mapping(vpp_interfaces) + if self.errors: + message = 'Failure(s) occurred when applying configuration' + logger.error(message) + for e in self.errors: + logger.error('stdout: %s, stderr: %s', e.stdout, e.stderr) + raise os_net_config.ConfigurationError(message) + return update_files -- cgit 1.2.3-korg