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_eni.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'os_net_config/impl_eni.py') diff --git a/os_net_config/impl_eni.py b/os_net_config/impl_eni.py index 360d8c8..944c4e9 100644 --- a/os_net_config/impl_eni.py +++ b/os_net_config/impl_eni.py @@ -241,6 +241,14 @@ class ENINetConfig(os_net_config.NetConfig): for interface in self.interfaces.keys(): self.ifup(interface) + + 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) else: logger.info('No interface changes are required.') -- cgit 1.2.3-korg