diff options
author | Scott Moser <smoser@brickies.net> | 2016-09-09 21:46:49 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-09-09 21:46:49 -0400 |
commit | ea732e69516983b1d9838b0d80540a832594748a (patch) | |
tree | f23cbf03e360f913e98e15d232bcf871770806e8 /cloudinit/net | |
parent | eb5860ec6ed76a90fb837001ab2ed54e1dcf78de (diff) | |
parent | 34a26f7f59f2963691e36ca0476bec9fc9ccef63 (diff) | |
download | vyos-cloud-init-ea732e69516983b1d9838b0d80540a832594748a.tar.gz vyos-cloud-init-ea732e69516983b1d9838b0d80540a832594748a.zip |
Merge branch 'master' into ubuntu/xenial
Diffstat (limited to 'cloudinit/net')
-rw-r--r-- | cloudinit/net/__init__.py | 9 | ||||
-rw-r--r-- | cloudinit/net/eni.py | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py index 21cc602b..7e58bfea 100644 --- a/cloudinit/net/__init__.py +++ b/cloudinit/net/__init__.py @@ -36,7 +36,7 @@ def read_sys_net(devname, path, translate=None, enoent=None, keyerror=None): try: contents = util.load_file(sys_dev_path(devname, path)) except (OSError, IOError) as e: - if getattr(e, 'errno', None) == errno.ENOENT: + if getattr(e, 'errno', None) in (errno.ENOENT, errno.ENOTDIR): if enoent is not None: return enoent raise @@ -347,7 +347,12 @@ def _rename_interfaces(renames, strict_present=True, strict_busy=True, def get_interface_mac(ifname): """Returns the string value of an interface's MAC Address""" - return read_sys_net(ifname, "address", enoent=False) + path = "address" + if os.path.isdir(sys_dev_path(ifname, "bonding_slave")): + # for a bond slave, get the nic's hwaddress, not the address it + # is using because its part of a bond. + path = "bonding_slave/perm_hwaddr" + return read_sys_net(ifname, path, enoent=False) def get_interfaces_by_mac(devs=None): diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py index eff5b924..cd533ddb 100644 --- a/cloudinit/net/eni.py +++ b/cloudinit/net/eni.py @@ -399,7 +399,7 @@ class Renderer(renderer.Renderer): else: # ifenslave docs say to auto the slave devices lines = [] - if 'bond-master' in iface: + if 'bond-master' in iface or 'bond-slaves' in iface: lines.append("auto {name}".format(**iface)) lines.append("iface {name} {inet} {mode}".format(**iface)) lines.extend(_iface_add_attrs(iface, index=0)) |