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@redhat.com --- 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
Thu, Oct 16, 2014 at 03:07:12PM CEST, jtluka@redhat.com wrote:
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@redhat.com
applied, thanks
lnst-developers@lists.fedorahosted.org