From ffa6fc88249aa080aa31811a45569a45e567418a Mon Sep 17 00:00:00 2001 From: James Falcon Date: Thu, 2 Dec 2021 22:36:37 -0600 Subject: Fix exception when no activator found (#1129) Given that there are additional network management tools that we haven't yet supported with activators, we should log a warning and continue without network activation here, especially since this was a no-op for years. LP: #1948681 --- cloudinit/net/activators.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cloudinit/net') diff --git a/cloudinit/net/activators.py b/cloudinit/net/activators.py index 11149548..137338d8 100644 --- a/cloudinit/net/activators.py +++ b/cloudinit/net/activators.py @@ -16,6 +16,10 @@ from cloudinit.net.sysconfig import NM_CFG_FILE LOG = logging.getLogger(__name__) +class NoActivatorException(Exception): + pass + + def _alter_interface(cmd, device_name) -> bool: LOG.debug("Attempting command %s for device %s", cmd, device_name) try: @@ -271,7 +275,7 @@ def select_activator(priority=None, target=None) -> Type[NetworkActivator]: tmsg = "" if target and target != "/": tmsg = " in target=%s" % target - raise RuntimeError( + raise NoActivatorException( "No available network activators found%s. Searched " "through list: %s" % (tmsg, priority)) selected = found[0] -- cgit v1.2.3