~oddbloke/cloud-init/fix-gce-az

« back to all changes in this revision

Viewing changes to cloudinit/sources/DataSourceGCE.py

  • Committer: Daniel Watkins
  • Date: 2015-07-22 12:06:34 UTC
  • Revision ID: daniel.watkins@canonical.com-20150722120634-90bdpdli7eora2j7
Add DataSource.region and use it in mirror selection.

Also implement DataSource.region for EC2 and GCE data sources.

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
    def availability_zone(self):
153
153
        return self.metadata['availability-zone']
154
154
 
 
155
    @property
 
156
    def region(self):
 
157
        return self.availability_zone.rsplit('-', 1)[0]
 
158
 
155
159
# Used to match classes to dependencies
156
160
datasources = [
157
161
    (DataSourceGCE, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK)),