From: Ondrej Lichtner <olichtne(a)redhat.com>
The _ipr_wrapper method implemented in the base Device class can safely
be used for the destroy operation of a SoftDevice. The methods are very
similar so this is just refactoring to reduce code duplication.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Devices/SoftDevice.py | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/lnst/Devices/SoftDevice.py b/lnst/Devices/SoftDevice.py
index 7a92c24..3373f1d 100644
--- a/lnst/Devices/SoftDevice.py
+++ b/lnst/Devices/SoftDevice.py
@@ -69,14 +69,5 @@ class SoftDevice(Device):
self.name, str(e)))
def destroy(self):
- with pyroute2.IPRoute() as ipr:
- try:
- logging.debug("Performing Netlink operation del for device {}
{}".
- format(self.ifindex, self.name))
- ipr.link("del", index=self.ifindex)
- self._if_manager.rescan_devices()
- except Exception as e:
- log_exc_traceback()
- raise DeviceConfigError("Deleting link {} failed: {}".format(
- self.name, str(e)))
+ self._ipr_wrapper("link", "del", index=self.ifindex)
return True
--
2.23.0
Show replies by date