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

« back to all changes in this revision

Viewing changes to cloudinit/sources/DataSourceEc2.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:
197
197
        except KeyError:
198
198
            return None
199
199
 
 
200
    @property
 
201
    def region(self):
 
202
        az = self.availability_zone
 
203
        if az is not None:
 
204
            return az[:-1]
 
205
        return None
 
206
 
200
207
# Used to match classes to dependencies
201
208
datasources = [
202
209
  (DataSourceEc2, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK)),