summaryrefslogtreecommitdiff
path: root/cloudinit/sources/__init__.py
diff options
context:
space:
mode:
authorDaniel Watkins <daniel.watkins@canonical.com>2015-07-22 13:06:34 +0100
committerDaniel Watkins <daniel.watkins@canonical.com>2015-07-22 13:06:34 +0100
commitbc7d57a0ae827978c87919c833bb5e8d2d5143c6 (patch)
tree4a3e97d4f0760f00682b9e84888c4b3f001c3777 /cloudinit/sources/__init__.py
parent73c5bbfa31b922a0ba403216c0fc1f63b22a9262 (diff)
downloadvyos-cloud-init-bc7d57a0ae827978c87919c833bb5e8d2d5143c6.tar.gz
vyos-cloud-init-bc7d57a0ae827978c87919c833bb5e8d2d5143c6.zip
Add DataSource.region and use it in mirror selection.
Also implement DataSource.region for EC2 and GCE data sources.
Diffstat (limited to 'cloudinit/sources/__init__.py')
-rw-r--r--cloudinit/sources/__init__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index 1a036638..a21c08c2 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -157,6 +157,10 @@ class DataSource(object):
return self.metadata.get('availability-zone',
self.metadata.get('availability_zone'))
+ @property
+ def region(self):
+ return self.metadata.get('region')
+
def get_instance_id(self):
if not self.metadata or 'instance-id' not in self.metadata:
# Return a magic not really instance id string