Scott Moser has proposed merging ~smoser/cloud-init:cleanup/get_by_mac_use_get_interfaces into cloud-init:master.
Commit message: 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. Requested reviews: cloud-init commiters (cloud-init-dev) For more details, see: https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/328542 -- Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:cleanup/get_by_mac_use_get_interfaces into cloud-init:master.
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py index 46cb9c8..1ff8fae 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'" %
_______________________________________________ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp