summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2019-06-25 16:06:27 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-06-25 16:06:27 +0000
commitfeebec1cbb462208003460d68d909e76cb68e0e2 (patch)
tree5e47b0cdeef6f4d8f8f79694d797c1992012a046 /cloudinit/sources
parentf57a77577dd708c7f57babf8cd63ec18134bf34a (diff)
downloadvyos-cloud-init-feebec1cbb462208003460d68d909e76cb68e0e2.tar.gz
vyos-cloud-init-feebec1cbb462208003460d68d909e76cb68e0e2.zip
azure: add region and AZ properties from imds compute location metadata
This allows cloud-init query region to show valid region data for Azure
Diffstat (limited to 'cloudinit/sources')
-rwxr-xr-xcloudinit/sources/DataSourceAzure.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index b7440c1d..d2fad9bb 100755
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -684,6 +684,11 @@ class DataSourceAzure(sources.DataSource):
return
@property
+ def availability_zone(self):
+ return self.metadata.get(
+ 'imds', {}).get('compute', {}).get('platformFaultDomain')
+
+ @property
def network_config(self):
"""Generate a network config like net.generate_fallback_network() with
the following exceptions.
@@ -701,6 +706,10 @@ class DataSourceAzure(sources.DataSource):
self._network_config = parse_network_config(nc_src)
return self._network_config
+ @property
+ def region(self):
+ return self.metadata.get('imds', {}).get('compute', {}).get('location')
+
def _partitions_on_device(devpath, maxnum=16):
# return a list of tuples (ptnum, path) for each part on devpath