diff options
author | Scott Moser <smoser@brickies.net> | 2017-08-03 16:38:09 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-08-03 16:38:09 -0400 |
commit | 9d923c1ab9c4556b980509513ece4a414269b5b9 (patch) | |
tree | ac1834f3ddefedf4fe9dc06728e1a072fc86e4f4 | |
parent | 9d0fdf1c6d39f8b6ff0f9e0172318bece56fed06 (diff) | |
download | vyos-cloud-init-9d923c1ab9c4556b980509513ece4a414269b5b9.tar.gz vyos-cloud-init-9d923c1ab9c4556b980509513ece4a414269b5b9.zip |
net: Reduce duplicate code. Have get_interfaces_by_mac use get_interfaces.
get_interfaces_by_mac and get_interfaces just looked much alike.
This makes get_interfaces_by_mac call get_interfaces.
-rw-r--r-- | cloudinit/net/__init__.py | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py index 46cb9c85..1ff8fae0 100644 --- a/cloudinit/net/__init__.py +++ b/cloudinit/net/__init__.py @@ -511,21 +511,7 @@ def get_interfaces_by_mac(): Bridges and any devices that have a 'stolen' mac are excluded.""" ret = {} - devs = get_devicelist() - empty_mac = '00:00:00:00:00:00' - for name in devs: - if not interface_has_own_mac(name): - continue - if is_bridge(name): - continue - if is_vlan(name): - continue - mac = get_interface_mac(name) - # some devices may not have a mac (tun0) - if not mac: - continue - if mac == empty_mac and name != 'lo': - continue + for name, mac, _driver, _devid in get_interfaces(): if mac in ret: raise RuntimeError( "duplicate mac found! both '%s' and '%s' have mac '%s'" % |