From 5959579b6614d82648695ec6f22579eb7395aaa8 Mon Sep 17 00:00:00 2001 From: Eric Benner Date: Thu, 17 Jun 2021 13:27:07 -0400 Subject: [PATCH 01/10] Fix various networking, script, and fringe os issues --- cloudinit/sources/DataSourceVultr.py | 11 ++-- cloudinit/sources/helpers/vultr.py | 50 ++++++++++++------- tests/unittests/test_datasource/test_vultr.py | 3 ++ 3 files changed, 44 insertions(+), 20 deletions(-) diff --git a/cloudinit/sources/DataSourceVultr.py b/cloudinit/sources/DataSourceVultr.py index c08ff848fe0..36f6b62c4b7 100644 --- a/cloudinit/sources/DataSourceVultr.py +++ b/cloudinit/sources/DataSourceVultr.py @@ -8,6 +8,7 @@ from cloudinit import log as log from cloudinit import sources from cloudinit import util +from cloudinit import version import cloudinit.sources.helpers.vultr as vultr @@ -16,7 +17,9 @@ 'url': 'http://169.254.169.254', 'retries': 30, 'timeout': 2, - 'wait': 2 + 'wait': 2, + 'user-agent': 'Cloud-Init/%s - OS: %s' % (version.version_string(), + util.system_info()['variant']) } @@ -92,7 +95,8 @@ def get_metadata(self): return vultr.get_metadata(self.ds_cfg['url'], self.ds_cfg['timeout'], self.ds_cfg['retries'], - self.ds_cfg['wait']) + self.ds_cfg['wait'], + self.ds_cfg['user-agent']) # Compare subid as instance id def check_instance_id(self, sys_cfg): @@ -137,7 +141,8 @@ def get_datasource_list(depends): md = vultr.get_metadata(BUILTIN_DS_CONFIG['url'], BUILTIN_DS_CONFIG['timeout'], BUILTIN_DS_CONFIG['retries'], - BUILTIN_DS_CONFIG['wait']) + BUILTIN_DS_CONFIG['wait'], + BUILTIN_DS_CONFIG['user-agent']) config = md['vendor-data']['config'] sysinfo = vultr.get_sysinfo() diff --git a/cloudinit/sources/helpers/vultr.py b/cloudinit/sources/helpers/vultr.py index c22cd0b12f5..1af370a8c53 100644 --- a/cloudinit/sources/helpers/vultr.py +++ b/cloudinit/sources/helpers/vultr.py @@ -11,18 +11,19 @@ from cloudinit import net from cloudinit.net.dhcp import EphemeralDHCPv4, NoDHCPLeaseError from functools import lru_cache +from os import path # Get LOG LOG = log.getLogger(__name__) @lru_cache() -def get_metadata(url, timeout, retries, sec_between): +def get_metadata(url, timeout, retries, sec_between, agent): # Bring up interface try: with EphemeralDHCPv4(connectivity_url=url): # Fetch the metadata - v1 = read_metadata(url, timeout, retries, sec_between) + v1 = read_metadata(url, timeout, retries, sec_between, agent) except (NoDHCPLeaseError) as exc: LOG.error("Bailing, DHCP Exception: %s", exc) raise @@ -64,12 +65,20 @@ def is_vultr(): # Read Metadata endpoint -def read_metadata(url, timeout, retries, sec_between): +def read_metadata(url, timeout, retries, sec_between, agent): url = "%s/v1.json" % url + + # We need to test the user-agent for distros that need + # special handling, such as the arch-iso + headers = { + 'Metadata-Token': 'vultr', + 'User-Agent': agent + } + response = url_helper.readurl(url, timeout=timeout, retries=retries, - headers={'Metadata-Token': 'vultr'}, + headers=headers, sec_between=sec_between) if not response.ok(): @@ -114,10 +123,11 @@ def generate_network_config(interfaces): public = generate_public_network_interface(interfaces[0]) network['config'].append(public) - # Prepare interface 1, private + # Prepare additional interfaces, private if len(interfaces) > 1: - private = generate_private_network_interface(interfaces[1]) - network['config'].append(private) + for i in range(1, len(interfaces)): + private = generate_private_network_interface(interfaces[i]) + network['config'].append(private) return network @@ -209,6 +219,10 @@ def generate_user_scripts(md, network_config): if md['vendor-data']['raid1-script']: user_scripts.append(md['vendor-data']['raid1-script']) + # JBOD script + if md['vendor-data']['jbod-script']: + user_scripts.append(md['vendor-data']['jbod-script']) + # Enable multi-queue on linux if util.is_Linux() and md['vendor-data']['ethtool-script']: ethtool_script = md['vendor-data']['ethtool-script'] @@ -216,16 +230,18 @@ def generate_user_scripts(md, network_config): # Tool location tool = "/opt/vultr/ethtool" - # Go through the interfaces - for netcfg in network_config: - # If the interface has a mac and is physical - if "mac_address" in netcfg and netcfg['type'] == "physical": - # Set its multi-queue to num of cores as per RHEL Docs - name = netcfg['name'] - command = "%s -L %s combined $(nproc --all)" % (tool, name) - ethtool_script = '%s\n%s' % (ethtool_script, command) - - user_scripts.append(ethtool_script) + # Only if the tool exists + if path.exists(tool): + # Go through the interfaces + for netcfg in network_config: + # If the interface has a mac and is physical + if "mac_address" in netcfg and netcfg['type'] == "physical": + # Set its multi-queue to num of cores as per RHEL Docs + name = netcfg['name'] + command = "%s -L %s combined $(nproc --all)" % (tool, name) + ethtool_script = '%s\n%s' % (ethtool_script, command) + + user_scripts.append(ethtool_script) # This is for vendor scripts if md['vendor-data']['vendor-script']: diff --git a/tests/unittests/test_datasource/test_vultr.py b/tests/unittests/test_datasource/test_vultr.py index bbea2aa3818..cbac518df2d 100644 --- a/tests/unittests/test_datasource/test_vultr.py +++ b/tests/unittests/test_datasource/test_vultr.py @@ -67,6 +67,8 @@ 'vendor-data': { 'vendor-script': '', 'ethtool-script': '', + 'raid1-script': '', + 'jbod-script': '', 'config': { 'package_upgrade': 'true', 'disable_root': 0, @@ -159,6 +161,7 @@ 'vendor-script': '', 'ethtool-script': '', 'raid1-script': '', + 'jbod-script': '', 'config': { 'package_upgrade': 'true', 'disable_root': 0, From b91eb2d285233ef8d6f7bb0491fc115422e922c8 Mon Sep 17 00:00:00 2001 From: Eric Benner Date: Thu, 22 Jul 2021 13:55:49 -0400 Subject: [PATCH 02/10] Reconfigure ipv6 dhcp --- cloudinit/sources/helpers/vultr.py | 2 +- tests/unittests/test_datasource/test_vultr.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cloudinit/sources/helpers/vultr.py b/cloudinit/sources/helpers/vultr.py index 1af370a8c53..5baede3055e 100644 --- a/cloudinit/sources/helpers/vultr.py +++ b/cloudinit/sources/helpers/vultr.py @@ -151,7 +151,7 @@ def generate_public_network_interface(interface): "control": "auto" }, { - "type": "dhcp6", + "type": "ipv6_slaac", "control": "auto" }, ] diff --git a/tests/unittests/test_datasource/test_vultr.py b/tests/unittests/test_datasource/test_vultr.py index cbac518df2d..8fd88df63b6 100644 --- a/tests/unittests/test_datasource/test_vultr.py +++ b/tests/unittests/test_datasource/test_vultr.py @@ -220,7 +220,7 @@ 'accept-ra': 1, 'subnets': [ {'type': 'dhcp', 'control': 'auto'}, - {'type': 'dhcp6', 'control': 'auto'} + {'type': 'ipv6_slaac', 'control': 'auto'} ], } ] @@ -240,7 +240,7 @@ 'accept-ra': 1, 'subnets': [ {'type': 'dhcp', 'control': 'auto'}, - {'type': 'dhcp6', 'control': 'auto'} + {'type': 'ipv6_slaac', 'control': 'auto'} ], }, { From f085a9ddf3c7f538086cfe17a3262d1d9acc68b1 Mon Sep 17 00:00:00 2001 From: Eric Benner Date: Fri, 6 Aug 2021 18:51:19 -0400 Subject: [PATCH 03/10] Cleanup and improve Vultr support --- cloudinit/sources/DataSourceVultr.py | 32 ++++----- cloudinit/sources/helpers/vultr.py | 69 +++++-------------- tests/unittests/test_datasource/test_vultr.py | 30 ++++---- 3 files changed, 45 insertions(+), 86 deletions(-) diff --git a/cloudinit/sources/DataSourceVultr.py b/cloudinit/sources/DataSourceVultr.py index c08ff848fe0..851bd03b6a2 100644 --- a/cloudinit/sources/DataSourceVultr.py +++ b/cloudinit/sources/DataSourceVultr.py @@ -8,6 +8,7 @@ from cloudinit import log as log from cloudinit import sources from cloudinit import util +from cloudinit import version import cloudinit.sources.helpers.vultr as vultr @@ -16,7 +17,11 @@ 'url': 'http://169.254.169.254', 'retries': 30, 'timeout': 2, - 'wait': 2 + 'wait': 2, + 'user-agent': 'Cloud-Init/%s - OS: %s Variant: %s' % + (version.version_string(), + util.system_info()['system'], + util.system_info()['variant']) } @@ -53,7 +58,7 @@ def _get_data(self): # Dump some data so diagnosing failures is manageable LOG.debug("Vultr Vendor Config:") - LOG.debug(md['vendor-data']['config']) + LOG.debug(util.json_dumps(md['vendor-data'])) LOG.debug("SUBID: %s", self.metadata['instanceid']) LOG.debug("Hostname: %s", self.metadata['local-hostname']) if self.userdata_raw is not None: @@ -64,14 +69,11 @@ def _get_data(self): # Process metadata def get_datasource_data(self, md): - # Grab config - config = md['vendor-data']['config'] - # Generate network config self.netcfg = vultr.generate_network_config(md['interfaces']) - # This requires info generated in the vendor config - user_scripts = vultr.generate_user_scripts(md, self.netcfg['config']) + # Grab vendordata + self.vendordata_raw = md['vendor-data'] # Default hostname is "guest" for whitelabel if self.metadata['local-hostname'] == "": @@ -81,18 +83,13 @@ def get_datasource_data(self, md): if self.userdata_raw == "": self.userdata_raw = None - # Assemble vendor-data - # This adds provided scripts and the config - self.vendordata_raw = [] - self.vendordata_raw.extend(user_scripts) - self.vendordata_raw.append("#cloud-config\n%s" % config) - # Get the metadata by flag def get_metadata(self): return vultr.get_metadata(self.ds_cfg['url'], self.ds_cfg['timeout'], self.ds_cfg['retries'], - self.ds_cfg['wait']) + self.ds_cfg['wait'], + self.ds_cfg['user-agent']) # Compare subid as instance id def check_instance_id(self, sys_cfg): @@ -137,11 +134,12 @@ def get_datasource_list(depends): md = vultr.get_metadata(BUILTIN_DS_CONFIG['url'], BUILTIN_DS_CONFIG['timeout'], BUILTIN_DS_CONFIG['retries'], - BUILTIN_DS_CONFIG['wait']) - config = md['vendor-data']['config'] + BUILTIN_DS_CONFIG['wait'], + BUILTIN_DS_CONFIG['user-agent']) + config = md['vendor-data'] sysinfo = vultr.get_sysinfo() print(util.json_dumps(sysinfo)) - print(config) + print(util.json_dumps(config)) # vi: ts=4 expandtab diff --git a/cloudinit/sources/helpers/vultr.py b/cloudinit/sources/helpers/vultr.py index c22cd0b12f5..0dc40f8a744 100644 --- a/cloudinit/sources/helpers/vultr.py +++ b/cloudinit/sources/helpers/vultr.py @@ -17,20 +17,17 @@ @lru_cache() -def get_metadata(url, timeout, retries, sec_between): +def get_metadata(url, timeout, retries, sec_between, agent): # Bring up interface try: with EphemeralDHCPv4(connectivity_url=url): # Fetch the metadata - v1 = read_metadata(url, timeout, retries, sec_between) + v1 = read_metadata(url, timeout, retries, sec_between, agent) except (NoDHCPLeaseError) as exc: LOG.error("Bailing, DHCP Exception: %s", exc) raise - v1_json = json.loads(v1) - metadata = v1_json - - return metadata + return json.loads(v1) # Read the system information from SMBIOS @@ -64,12 +61,20 @@ def is_vultr(): # Read Metadata endpoint -def read_metadata(url, timeout, retries, sec_between): +def read_metadata(url, timeout, retries, sec_between, agent): url = "%s/v1.json" % url + + # Announce os details so we can handle non Vultr origin + # images and provide correct vendordata generation. + headers = { + 'Metadata-Token': 'cloudinit', + 'User-Agent': agent + } + response = url_helper.readurl(url, timeout=timeout, retries=retries, - headers={'Metadata-Token': 'vultr'}, + headers=headers, sec_between=sec_between) if not response.ok(): @@ -114,10 +119,11 @@ def generate_network_config(interfaces): public = generate_public_network_interface(interfaces[0]) network['config'].append(public) - # Prepare interface 1, private + # Prepare additional interfaces, private if len(interfaces) > 1: - private = generate_private_network_interface(interfaces[1]) - network['config'].append(private) + for i in range(1, len(interfaces)): + private = generate_private_network_interface(interfaces[i]) + network['config'].append(private) return network @@ -141,7 +147,7 @@ def generate_public_network_interface(interface): "control": "auto" }, { - "type": "dhcp6", + "type": "ipv6_slaac", "control": "auto" }, ] @@ -187,7 +193,6 @@ def generate_private_network_interface(interface): "name": interface_name, "type": "physical", "mac_address": interface['mac'], - "accept-ra": 1, "subnets": [ { "type": "static", @@ -201,42 +206,4 @@ def generate_private_network_interface(interface): return netcfg -# This is for the vendor and startup scripts -def generate_user_scripts(md, network_config): - user_scripts = [] - - # Raid 1 script - if md['vendor-data']['raid1-script']: - user_scripts.append(md['vendor-data']['raid1-script']) - - # Enable multi-queue on linux - if util.is_Linux() and md['vendor-data']['ethtool-script']: - ethtool_script = md['vendor-data']['ethtool-script'] - - # Tool location - tool = "/opt/vultr/ethtool" - - # Go through the interfaces - for netcfg in network_config: - # If the interface has a mac and is physical - if "mac_address" in netcfg and netcfg['type'] == "physical": - # Set its multi-queue to num of cores as per RHEL Docs - name = netcfg['name'] - command = "%s -L %s combined $(nproc --all)" % (tool, name) - ethtool_script = '%s\n%s' % (ethtool_script, command) - - user_scripts.append(ethtool_script) - - # This is for vendor scripts - if md['vendor-data']['vendor-script']: - user_scripts.append(md['vendor-data']['vendor-script']) - - # Startup script - script = md['startup-script'] - if script and script != "echo No configured startup script": - user_scripts.append(script) - - return user_scripts - - # vi: ts=4 expandtab diff --git a/tests/unittests/test_datasource/test_vultr.py b/tests/unittests/test_datasource/test_vultr.py index bbea2aa3818..6323500936d 100644 --- a/tests/unittests/test_datasource/test_vultr.py +++ b/tests/unittests/test_datasource/test_vultr.py @@ -64,10 +64,8 @@ 'raid1-script': '', 'user-data': [ ], - 'vendor-data': { - 'vendor-script': '', - 'ethtool-script': '', - 'config': { + 'vendor-data': [ + { 'package_upgrade': 'true', 'disable_root': 0, 'ssh_pwauth': 1, @@ -83,7 +81,7 @@ } } } - } + ] } VULTR_V1_2 = { @@ -155,11 +153,8 @@ 'user-data': [ ], - 'vendor-data': { - 'vendor-script': '', - 'ethtool-script': '', - 'raid1-script': '', - 'config': { + 'vendor-data': [ + { 'package_upgrade': 'true', 'disable_root': 0, 'ssh_pwauth': 1, @@ -175,7 +170,7 @@ } } } - } + ] } SSH_KEYS_1 = [ @@ -217,7 +212,7 @@ 'accept-ra': 1, 'subnets': [ {'type': 'dhcp', 'control': 'auto'}, - {'type': 'dhcp6', 'control': 'auto'} + {'type': 'ipv6_slaac', 'control': 'auto'} ], } ] @@ -237,14 +232,13 @@ 'accept-ra': 1, 'subnets': [ {'type': 'dhcp', 'control': 'auto'}, - {'type': 'dhcp6', 'control': 'auto'} + {'type': 'ipv6_slaac', 'control': 'auto'} ], }, { 'name': 'eth1', 'type': 'physical', 'mac_address': '5a:00:03:1b:4e:ca', - 'accept-ra': 1, 'subnets': [ { "type": "static", @@ -270,12 +264,12 @@ def setUp(self): super(TestDataSourceVultr, self).setUp() # Stored as a dict to make it easier to maintain - raw1 = json.dumps(VULTR_V1_1['vendor-data']['config']) - raw2 = json.dumps(VULTR_V1_2['vendor-data']['config']) + raw1 = json.dumps(VULTR_V1_1['vendor-data'][0]) + raw2 = json.dumps(VULTR_V1_2['vendor-data'][0]) # Make expected format - VULTR_V1_1['vendor-data']['config'] = raw1 - VULTR_V1_2['vendor-data']['config'] = raw2 + VULTR_V1_1['vendor-data'] = [raw1] + VULTR_V1_2['vendor-data'] = [raw2] self.tmp = self.tmp_dir() From ddbcdbb340eaf3fdc216548876a1bb49f58c4d1d Mon Sep 17 00:00:00 2001 From: Eric Benner Date: Tue, 17 Aug 2021 14:04:26 -0400 Subject: [PATCH 04/10] Cleanup unused --- cloudinit/sources/helpers/vultr.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cloudinit/sources/helpers/vultr.py b/cloudinit/sources/helpers/vultr.py index 06523dd5a57..0dc40f8a744 100644 --- a/cloudinit/sources/helpers/vultr.py +++ b/cloudinit/sources/helpers/vultr.py @@ -11,7 +11,6 @@ from cloudinit import net from cloudinit.net.dhcp import EphemeralDHCPv4, NoDHCPLeaseError from functools import lru_cache -from os import path # Get LOG LOG = log.getLogger(__name__) From 5b8f4efc523e16642a26e7059dbe1528e8a91adf Mon Sep 17 00:00:00 2001 From: Eric Benner Date: Tue, 28 Sep 2021 11:59:26 -0400 Subject: [PATCH 05/10] Allow Vultr to set MTU and use as-is configs --- cloudinit/sources/DataSourceVultr.py | 7 ++++++- cloudinit/sources/helpers/vultr.py | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/cloudinit/sources/DataSourceVultr.py b/cloudinit/sources/DataSourceVultr.py index 92765c723f0..c88062a14c7 100644 --- a/cloudinit/sources/DataSourceVultr.py +++ b/cloudinit/sources/DataSourceVultr.py @@ -67,7 +67,12 @@ def _get_data(self): # Process metadata def get_datasource_data(self, md): # Generate network config - self.netcfg = vultr.generate_network_config(md['interfaces']) + 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.do_network_interfaces(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 9effb0d9471..8c1443f12a8 100644 --- a/cloudinit/sources/helpers/vultr.py +++ b/cloudinit/sources/helpers/vultr.py @@ -152,6 +152,13 @@ def generate_public_network_interface(interface): ] } + # Options that may or may not be used + if "mtu" in interface: + netcfg['mtu'] = interface['mtu'] + + if "accept-ra" in interface: + netcfg['accept-ra'] = interface['accept-ra'] + # Check for additional IP's additional_count = len(interface['ipv4']['additional']) if "ipv4" in interface and additional_count > 0: @@ -202,7 +209,27 @@ def generate_private_network_interface(interface): ] } + # Options that may or may not be used + if "mtu" in interface: + netcfg['mtu'] = interface['mtu'] + + if "accept-ra" in interface: + netcfg['accept-ra'] = interface['accept-ra'] + return netcfg +# Make required adjustments to the network configs provided +def do_network_interfaces(interfaces): + for interface in interfaces: + interface_name = get_interface_name(interface['mac']) + if not interface_name: + raise RuntimeError( + "Interface: %s could not be found on the system" % + interface['mac']) + interface['name'] = interface_name + + return interfaces + + # vi: ts=4 expandtab From 8880a7cff87ab207b8e75d36eebf863b296779e9 Mon Sep 17 00:00:00 2001 From: Eric Benner Date: Tue, 28 Sep 2021 12:39:38 -0400 Subject: [PATCH 06/10] Add route support --- cloudinit/sources/helpers/vultr.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cloudinit/sources/helpers/vultr.py b/cloudinit/sources/helpers/vultr.py index 8c1443f12a8..dc845055d09 100644 --- a/cloudinit/sources/helpers/vultr.py +++ b/cloudinit/sources/helpers/vultr.py @@ -169,6 +169,10 @@ def generate_public_network_interface(interface): "address": additional['address'], "netmask": additional['netmask'] } + + if "routes" in additional: + add['routes'] = additional['routes'] + netcfg['subnets'].append(add) # Check for additional IPv6's @@ -181,6 +185,10 @@ def generate_public_network_interface(interface): "address": additional['address'], "netmask": additional['netmask'] } + + if "routes" in additional: + add['routes'] = additional['routes'] + netcfg['subnets'].append(add) # Add config to template @@ -216,6 +224,9 @@ def generate_private_network_interface(interface): if "accept-ra" in interface: netcfg['accept-ra'] = interface['accept-ra'] + if "routes" in interface: + netcfg['subnets'][0]['routes'] = interface['routes'] + return netcfg From 65281109999d063f95c6fba3ed6fb5c997d5ed32 Mon Sep 17 00:00:00 2001 From: Eric Benner Date: Tue, 28 Sep 2021 12:42:09 -0400 Subject: [PATCH 07/10] Add route support --- cloudinit/sources/helpers/vultr.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cloudinit/sources/helpers/vultr.py b/cloudinit/sources/helpers/vultr.py index dc845055d09..bbee637aeeb 100644 --- a/cloudinit/sources/helpers/vultr.py +++ b/cloudinit/sources/helpers/vultr.py @@ -159,6 +159,9 @@ def generate_public_network_interface(interface): if "accept-ra" in interface: netcfg['accept-ra'] = interface['accept-ra'] + if "routes" in interface: + netcfg['subnets'][0]['routes'] = interface['routes'] + # Check for additional IP's additional_count = len(interface['ipv4']['additional']) if "ipv4" in interface and additional_count > 0: @@ -224,7 +227,7 @@ def generate_private_network_interface(interface): if "accept-ra" in interface: netcfg['accept-ra'] = interface['accept-ra'] - if "routes" in interface: + if "routes" in interface['ipv4']: netcfg['subnets'][0]['routes'] = interface['routes'] return netcfg From 1561a2c2fa0ac9aefc1e2586e7c1216558f07e29 Mon Sep 17 00:00:00 2001 From: Eric Benner Date: Tue, 28 Sep 2021 13:31:22 -0400 Subject: [PATCH 08/10] Add route support --- cloudinit/sources/helpers/vultr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinit/sources/helpers/vultr.py b/cloudinit/sources/helpers/vultr.py index bbee637aeeb..a2aef436311 100644 --- a/cloudinit/sources/helpers/vultr.py +++ b/cloudinit/sources/helpers/vultr.py @@ -227,7 +227,7 @@ def generate_private_network_interface(interface): if "accept-ra" in interface: netcfg['accept-ra'] = interface['accept-ra'] - if "routes" in interface['ipv4']: + if "routes" in interface: netcfg['subnets'][0]['routes'] = interface['routes'] return netcfg From 470ac9455889823b36d85d968276424b44652c2c Mon Sep 17 00:00:00 2001 From: Eric Benner Date: Thu, 30 Sep 2021 02:08:27 -0400 Subject: [PATCH 09/10] Fix naming of do_network_interfaces --- cloudinit/sources/DataSourceVultr.py | 2 +- cloudinit/sources/helpers/vultr.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudinit/sources/DataSourceVultr.py b/cloudinit/sources/DataSourceVultr.py index c88062a14c7..ebbc09de92f 100644 --- a/cloudinit/sources/DataSourceVultr.py +++ b/cloudinit/sources/DataSourceVultr.py @@ -70,7 +70,7 @@ def get_datasource_data(self, md): 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.do_network_interfaces(md['cloud_interfaces']) + self.netcfg = vultr.add_network_interfaces(md['cloud_interfaces']) else: self.netcfg = vultr.generate_network_config(md['interfaces']) diff --git a/cloudinit/sources/helpers/vultr.py b/cloudinit/sources/helpers/vultr.py index a2aef436311..b6fefc8ebe7 100644 --- a/cloudinit/sources/helpers/vultr.py +++ b/cloudinit/sources/helpers/vultr.py @@ -234,7 +234,7 @@ def generate_private_network_interface(interface): # Make required adjustments to the network configs provided -def do_network_interfaces(interfaces): +def add_network_interfaces(interfaces): for interface in interfaces: interface_name = get_interface_name(interface['mac']) if not interface_name: From 500b12ce191a48ea0e943849393602a5200ab1a8 Mon Sep 17 00:00:00 2001 From: Eric Benner Date: Thu, 30 Sep 2021 02:09:06 -0400 Subject: [PATCH 10/10] Fix naming of do_network_interfaces --- cloudinit/sources/DataSourceVultr.py | 2 +- cloudinit/sources/helpers/vultr.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudinit/sources/DataSourceVultr.py b/cloudinit/sources/DataSourceVultr.py index ebbc09de92f..68e1ff0b9f8 100644 --- a/cloudinit/sources/DataSourceVultr.py +++ b/cloudinit/sources/DataSourceVultr.py @@ -70,7 +70,7 @@ def get_datasource_data(self, md): 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_network_interfaces(md['cloud_interfaces']) + self.netcfg = vultr.add_interface_names(md['cloud_interfaces']) else: self.netcfg = vultr.generate_network_config(md['interfaces']) diff --git a/cloudinit/sources/helpers/vultr.py b/cloudinit/sources/helpers/vultr.py index b6fefc8ebe7..55487ac31c6 100644 --- a/cloudinit/sources/helpers/vultr.py +++ b/cloudinit/sources/helpers/vultr.py @@ -234,7 +234,7 @@ def generate_private_network_interface(interface): # Make required adjustments to the network configs provided -def add_network_interfaces(interfaces): +def add_interface_names(interfaces): for interface in interfaces: interface_name = get_interface_name(interface['mac']) if not interface_name: