summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceGCE.py
diff options
context:
space:
mode:
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)),