commit 49d5000679a244872c65bdc520ed659958a911e8
Author: Jan Tluka <jtluka(a)redhat.com>
Date: Thu Oct 16 15:07:12 2014 +0200
update imports to pyroute 0.3.x version
Version 2 of the patch dealing with pyroute code restructuring.
V2:
To be compatible with pyroute 0.2.x LNST will try to import relevant
pyroute parts in old way and if that fails it will try to import in new
way.
There have been some changes in pyroute code structuring so we have to
adapt these changes in our code.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Common/NetUtils.py | 8 ++++++--
lnst/Slave/InterfaceManager.py | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/lnst/Common/NetUtils.py b/lnst/Common/NetUtils.py
index 79d2de7..9563b3c 100644
--- a/lnst/Common/NetUtils.py
+++ b/lnst/Common/NetUtils.py
@@ -20,8 +20,12 @@ from pyroute2.netlink import NLM_F_REQUEST
from pyroute2.netlink import NLM_F_DUMP
from pyroute2.netlink import NLMSG_DONE
from pyroute2.netlink import NLMSG_ERROR
-from pyroute2.netlink.iproute import RTM_GETLINK
-from pyroute2.netlink.iproute import RTM_NEWLINK
+try:
+ from pyroute2.netlink.iproute import RTM_GETLINK
+ from pyroute2.netlink.iproute import RTM_NEWLINK
+except ImportError:
+ from pyroute2.iproute import RTM_GETLINK
+ from pyroute2.iproute import RTM_NEWLINK
from pyroute2.netlink.rtnl.ifinfmsg import ifinfmsg
def normalize_hwaddr(hwaddr):
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 81347a6..68866b8 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -19,8 +19,12 @@ from lnst.Common.NetUtils import normalize_hwaddr
from lnst.Common.NetUtils import scan_netdevs
from lnst.Common.ExecCmd import exec_cmd
from pyroute2 import IPRSocket
-from pyroute2.netlink.iproute import RTM_NEWLINK
-from pyroute2.netlink.iproute import RTM_DELLINK
+try:
+ from pyroute2.netlink.iproute import RTM_NEWLINK
+ from pyroute2.netlink.iproute import RTM_DELLINK
+except ImportError:
+ from pyroute2.iproute import RTM_NEWLINK
+ from pyroute2.iproute import RTM_DELLINK
class IfMgrError(Exception):
pass