diff options
author | Daniel Watkins <daniel.watkins@canonical.com> | 2015-07-22 13:06:34 +0100 |
---|---|---|
committer | Daniel Watkins <daniel.watkins@canonical.com> | 2015-07-22 13:06:34 +0100 |
commit | bc7d57a0ae827978c87919c833bb5e8d2d5143c6 (patch) | |
tree | 4a3e97d4f0760f00682b9e84888c4b3f001c3777 /cloudinit/sources/DataSourceEc2.py | |
parent | 73c5bbfa31b922a0ba403216c0fc1f63b22a9262 (diff) | |
download | vyos-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/DataSourceEc2.py')
-rw-r--r-- | cloudinit/sources/DataSourceEc2.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py index 798869b7..0032d06c 100644 --- a/cloudinit/sources/DataSourceEc2.py +++ b/cloudinit/sources/DataSourceEc2.py @@ -197,6 +197,13 @@ class DataSourceEc2(sources.DataSource): except KeyError: return None + @property + def region(self): + az = self.availability_zone + if az is not None: + return az[:-1] + return None + # Used to match classes to dependencies datasources = [ (DataSourceEc2, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK)), |