diff options
author | Scott Moser <smoser@ubuntu.com> | 2018-05-09 17:40:56 -0600 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2018-05-09 17:40:56 -0600 |
commit | 23a84d2ce4ec44a0a0c2edbc3b1948c59bb0afbb (patch) | |
tree | 84496c78ef0777cf538e7f556c78ad9151d68208 /cloudinit/net/__init__.py | |
parent | 323eb30940cae2069daf74517089220fccc4afb9 (diff) | |
download | vyos-cloud-init-23a84d2ce4ec44a0a0c2edbc3b1948c59bb0afbb.tar.gz vyos-cloud-init-23a84d2ce4ec44a0a0c2edbc3b1948c59bb0afbb.zip |
SmartOS: fix get_interfaces for nics that do not have addr_assign_type.
When attempting to apply network configuration for SmartOS's container
platform, cloud-init would not identify nics. The nics on provided
in this container service do not have 'addr_assign_type'. That
was being interpreted as being a "stolen" mac, and would be filtered
out by get_interfaces.
Diffstat (limited to 'cloudinit/net/__init__.py')
-rw-r--r-- | cloudinit/net/__init__.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py index 43226bd0..3ffde52c 100644 --- a/cloudinit/net/__init__.py +++ b/cloudinit/net/__init__.py @@ -359,8 +359,12 @@ def interface_has_own_mac(ifname, strict=False): 1: randomly generated 3: set using dev_set_mac_address""" assign_type = read_sys_net_int(ifname, "addr_assign_type") - if strict and assign_type is None: - raise ValueError("%s had no addr_assign_type.") + if assign_type is None: + # None is returned if this nic had no 'addr_assign_type' entry. + # if strict, raise an error, if not return True. + if strict: + raise ValueError("%s had no addr_assign_type.") + return True return assign_type in (0, 1, 3) |