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

« back to all changes in this revision

Viewing changes to cloudinit/sources/__init__.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:
157
157
        return self.metadata.get('availability-zone',
158
158
                                 self.metadata.get('availability_zone'))
159
159
 
 
160
    @property
 
161
    def region(self):
 
162
        return self.metadata.get('region')
 
163
 
160
164
    def get_instance_id(self):
161
165
        if not self.metadata or 'instance-id' not in self.metadata:
162
166
            # Return a magic not really instance id string