diff options
author | eb3095 <45504889+eb3095@users.noreply.github.com> | 2023-02-01 15:46:18 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-01 21:46:18 +0100 |
commit | 30a71f368bc38c37afa36e7be830dd8a6002fbe8 (patch) | |
tree | bd9b7b8829b73fe035e65b7cbbb54f2b007878be /cloudinit/sources | |
parent | f447bab61d02e78e1a10becde38219a7537d548c (diff) | |
download | cloud-init-git-30a71f368bc38c37afa36e7be830dd8a6002fbe8.tar.gz |
Fix Vultr cloud_interfaces usage (#1986)
cloud_interfaces is intended to be a netcfg. Change the helper function to reflect this.
Diffstat (limited to 'cloudinit/sources')
-rw-r--r-- | cloudinit/sources/DataSourceVultr.py | 4 | ||||
-rw-r--r-- | cloudinit/sources/helpers/vultr.py | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/cloudinit/sources/DataSourceVultr.py b/cloudinit/sources/DataSourceVultr.py index a2c16991..9d7c84fb 100644 --- a/cloudinit/sources/DataSourceVultr.py +++ b/cloudinit/sources/DataSourceVultr.py @@ -70,10 +70,10 @@ class DataSourceVultr(sources.DataSource): if "cloud_interfaces" in md: # In the future we will just drop pre-configured # network configs into the array. They need names though. - self.netcfg = vultr.add_interface_names(md["cloud_interfaces"]) + vultr.add_interface_names(md["cloud_interfaces"]) + self.netcfg = md["cloud_interfaces"] else: self.netcfg = vultr.generate_network_config(md["interfaces"]) - # Grab vendordata self.vendordata_raw = md["vendor-data"] diff --git a/cloudinit/sources/helpers/vultr.py b/cloudinit/sources/helpers/vultr.py index 30c8cfee..836108d4 100644 --- a/cloudinit/sources/helpers/vultr.py +++ b/cloudinit/sources/helpers/vultr.py @@ -276,17 +276,17 @@ def generate_interface_additional_addresses(interface, netcfg): # Make required adjustments to the network configs provided -def add_interface_names(interfaces): - for interface in interfaces: - interface_name = get_interface_name(interface["mac"]) +def add_interface_names(netcfg): + for interface in netcfg["config"]: + if interface["type"] != "physical": + continue + interface_name = get_interface_name(interface["mac_address"]) if not interface_name: raise RuntimeError( "Interface: %s could not be found on the system" - % interface["mac"] + % interface["mac_address"] ) interface["name"] = interface_name - return interfaces - # vi: ts=4 expandtab |