From: Ondrej Lichtner <olichtne(a)redhat.com>
If the NM connection was deactivated during test execution and never
reactivated, the deconfiguration of the Slave failed due to an unhandled
exception. This left the slave in an inconsistent state and failed the
recipe execution.
This commit fixes that catching the related exception and ignoring it.
Fixes #145.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Slave/NmConfigDevice.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lnst/Slave/NmConfigDevice.py b/lnst/Slave/NmConfigDevice.py
index cbd3420..a9e0c1f 100644
--- a/lnst/Slave/NmConfigDevice.py
+++ b/lnst/Slave/NmConfigDevice.py
@@ -17,6 +17,7 @@ import dbus
import uuid
import socket, struct
import time
+from dbus.exceptions import DBusException
from lnst.Common.ExecCmd import exec_cmd
from lnst.Slave.NetConfigCommon import get_slaves, get_option, get_slave_option,
parse_netem
from lnst.Common.NetUtils import scan_netdevs
@@ -291,7 +292,14 @@ class NmConfigDeviceGeneric(object):
% config["name"])
logging.debug("Active connection object path: %s"
% self._acon_obj_path)
- self._nm_if.DeactivateConnection(self._acon_obj_path)
+ try:
+ self._nm_if.DeactivateConnection(self._acon_obj_path)
+ except DBusException as e:
+ if e.get_dbus_name() == "org.freedesktop.NetworkManager."\
+ "ConnectionNotActive":
+ pass
+ else:
+ raise e
self._acon_obj_path = None
def nm_enslave(self, slave_type, master_uuid, slave_conf):
--
2.9.0