summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceGCE.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-07-22 15:04:27 -0400
committerScott Moser <smoser@ubuntu.com>2015-07-22 15:04:27 -0400
commitde18aa66ad5cfdff5e0e25ae4f8f7a0328021b5b (patch)
tree5411ebc10bb3a23dd6a04cc71ac45054a4d9cb31 /cloudinit/sources/DataSourceGCE.py
parent8f37f2755d7e1ab9a6537bb7faa68df142cc99e4 (diff)
parenta86942a57cea02f69cf250053ebf1db79c7d5157 (diff)
downloadvyos-cloud-init-de18aa66ad5cfdff5e0e25ae4f8f7a0328021b5b.tar.gz
vyos-cloud-init-de18aa66ad5cfdff5e0e25ae4f8f7a0328021b5b.zip
provide data source to mirror selection code for region-specific mirrors.
This makes the full data source available to the mirror selection code, which means we can implement region logic on the data source for everything to use rather than it being mirror-selection-specific. It also implements that region logic for EC2 and GCE. LP: #1470890
Diffstat (limited to 'cloudinit/sources/DataSourceGCE.py')
-rw-r--r--cloudinit/sources/DataSourceGCE.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceGCE.py b/cloudinit/sources/DataSourceGCE.py
index 1b28a68c..7e7fc033 100644
--- a/cloudinit/sources/DataSourceGCE.py
+++ b/cloudinit/sources/DataSourceGCE.py
@@ -152,6 +152,10 @@ class DataSourceGCE(sources.DataSource):
def availability_zone(self):
return self.metadata['availability-zone']
+ @property
+ def region(self):
+ return self.availability_zone.rsplit('-', 1)[0]
+
# Used to match classes to dependencies
datasources = [
(DataSourceGCE, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK)),