summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceVultr.py
diff options
context:
space:
mode:
authoreb3095 <45504889+eb3095@users.noreply.github.com>2022-01-19 18:51:42 -0500
committerGitHub <noreply@github.com>2022-01-19 16:51:42 -0700
commit69f9a7888ea770f4dc0454be91dea225bdd5957c (patch)
tree082f6c9f717158257aa1e92c5daf00358c019fd8 /cloudinit/sources/DataSourceVultr.py
parent4c7d159c3efe39860d3c01bf680ba686b87adb77 (diff)
downloadvyos-cloud-init-69f9a7888ea770f4dc0454be91dea225bdd5957c.tar.gz
vyos-cloud-init-69f9a7888ea770f4dc0454be91dea225bdd5957c.zip
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.
Diffstat (limited to 'cloudinit/sources/DataSourceVultr.py')
-rw-r--r--cloudinit/sources/DataSourceVultr.py6
1 files changed, 5 insertions, 1 deletions
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