Do not import pyroute2 on Windows
Pyroute2 is not available on Windows, for which reason we need some platform checks. At the moment, the ovs plugin can no longer be loaded on Windows because of this import error. Change-Id: I4aacd17e77d3b22b8245106d325a7e393794f0a1 Closes-Bug: #1801029
This commit is contained in:
parent
c5fda08d40
commit
dd69c70dfb
|
@ -13,9 +13,7 @@
|
|||
import os
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from os_vif.internal.command.ip.linux import impl_pyroute2 as linux_ip_lib
|
||||
from os_vif.internal.command.ip.windows import impl_netifaces as win_ip_lib
|
||||
from oslo_utils import importutils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -23,6 +21,8 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
def _get_impl():
|
||||
if os.name == 'nt':
|
||||
return win_ip_lib.Netifaces()
|
||||
impl = 'os_vif.internal.command.ip.windows.impl_netifaces.Netifaces'
|
||||
else:
|
||||
return linux_ip_lib.PyRoute2()
|
||||
impl = 'os_vif.internal.command.ip.linux.impl_pyroute2.PyRoute2'
|
||||
|
||||
return importutils.import_object(impl)
|
||||
|
|
Loading…
Reference in New Issue