From 69f9a7888ea770f4dc0454be91dea225bdd5957c Mon Sep 17 00:00:00 2001 From: eb3095 <45504889+eb3095@users.noreply.github.com> Date: Wed, 19 Jan 2022 18:51:42 -0500 Subject: Seek interfaces, skip dummy interface, fix region codes (#1192) We were seeing issues where if anything showed up before the expected first adapter, booting could fail. This switches to seeking for a working interface to handle edge cases. Also fixes region code handling. --- cloudinit/sources/DataSourceVultr.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cloudinit/sources/DataSourceVultr.py') diff --git a/cloudinit/sources/DataSourceVultr.py b/cloudinit/sources/DataSourceVultr.py index 13f7c24d..8c2e82c2 100644 --- a/cloudinit/sources/DataSourceVultr.py +++ b/cloudinit/sources/DataSourceVultr.py @@ -48,8 +48,12 @@ class DataSourceVultr(sources.DataSource): # Fetch metadata self.metadata = self.get_metadata() - self.metadata["instance-id"] = self.metadata["instanceid"] + self.metadata["instance-id"] = self.metadata["instance-v2-id"] self.metadata["local-hostname"] = self.metadata["hostname"] + region = self.metadata["region"]["regioncode"] + if "countrycode" in self.metadata["region"]: + region = self.metadata["region"]["countrycode"] + self.metadata["region"] = region.lower() self.userdata_raw = self.metadata["user-data"] # Generate config and process data -- cgit v1.2.3