aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-03-02 21:08:49 +0000
committerGerrit Code Review <review@openstack.org>2016-03-02 21:08:49 +0000
commitc545e46f8fe2362df81e86c187aa6e50be185ad6 (patch)
tree0ed041db7c9408ccae508f44c532b585864adfd2
parent047294481fc4a2161e8ef637ad3a2706b85bce26 (diff)
parentcb4f56f72cd9a194661762c343c48392d70ba6ce (diff)
Merge "launchpad bug 1537330, fix _is_active_nic"
-rw-r--r--os_net_config/utils.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/os_net_config/utils.py b/os_net_config/utils.py
index ab7f3b3..4109081 100644
--- a/os_net_config/utils.py
+++ b/os_net_config/utils.py
@@ -55,10 +55,8 @@ def _is_active_nic(interface_name):
if interface_name == 'lo':
return False
- addr_assign_type = None
- with open(_SYS_CLASS_NET + '/%s/addr_assign_type' % interface_name,
- 'r') as f:
- addr_assign_type = int(f.read().rstrip())
+ device_dir = _SYS_CLASS_NET + '/%s/device' % interface_name
+ has_device_dir = os.path.isdir(device_dir)
carrier = None
with open(_SYS_CLASS_NET + '/%s/carrier' % interface_name, 'r') as f:
@@ -68,7 +66,7 @@ def _is_active_nic(interface_name):
with open(_SYS_CLASS_NET + '/%s/address' % interface_name, 'r') as f:
address = f.read().rstrip()
- if addr_assign_type == 0 and carrier == 1 and address:
+ if has_device_dir and carrier == 1 and address:
return True
else:
return False