aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Slagle <jslagle@redhat.com>2016-03-10 14:33:53 -0500
committerJames Slagle <jslagle@redhat.com>2016-05-23 13:34:57 +0000
commit5a6f63a1ad80e3218eb5e1c5098aa30694660339 (patch)
tree05c989e80fde054d29f31f14d6f1499043bffff0
parent60475755e3750b2d2e047578a68c8c2327bf50d7 (diff)
Add some debugging output to ordered_active_nics
Occassionally I've found myself debugging os-net-config's behavior related to detecting active nics. This adds a little debugging output to help see what's going on in the ordered_active_nics function. Change-Id: If7ea010071d2253b29aaaabb242690ea5fbfb165
-rw-r--r--os_net_config/utils.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/os_net_config/utils.py b/os_net_config/utils.py
index 4e25d30..7ff19fb 100644
--- a/os_net_config/utils.py
+++ b/os_net_config/utils.py
@@ -83,19 +83,26 @@ def _natural_sort_key(s):
def ordered_active_nics():
embedded_nics = []
nics = []
+ logger.debug("Finding active nics")
for name in glob.iglob(_SYS_CLASS_NET + '/*'):
nic = name[(len(_SYS_CLASS_NET) + 1):]
if _is_active_nic(nic):
if nic.startswith('em') or nic.startswith('eth') or \
nic.startswith('eno'):
+ logger.debug("%s is an embedded active nic" % nic)
embedded_nics.append(nic)
else:
+ logger.debug("%s is an active nic" % nic)
nics.append(nic)
+ else:
+ logger.debug("%s is not an active nic" % nic)
# NOTE: we could just natural sort all active devices,
# but this ensures em, eno, and eth are ordered first
# (more backwards compatible)
- return (sorted(embedded_nics, key=_natural_sort_key) +
- sorted(nics, key=_natural_sort_key))
+ active_nics = (sorted(embedded_nics, key=_natural_sort_key) +
+ sorted(nics, key=_natural_sort_key))
+ logger.debug("Active nics are %s" % active_nics)
+ return active_nics
def diff(filename, data):