From 30a71f368bc38c37afa36e7be830dd8a6002fbe8 Mon Sep 17 00:00:00 2001 From: eb3095 <45504889+eb3095@users.noreply.github.com> Date: Wed, 1 Feb 2023 15:46:18 -0500 Subject: Fix Vultr cloud_interfaces usage (#1986) cloud_interfaces is intended to be a netcfg. Change the helper function to reflect this. --- cloudinit/sources/DataSourceVultr.py | 4 ++-- cloudinit/sources/helpers/vultr.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'cloudinit/sources') 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 -- cgit v1.2.1