summaryrefslogtreecommitdiff
path: root/cloudinit/sources/__init__.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-08-27 10:56:47 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-08-27 10:56:47 -0700
commit92b99b325b2d437825cc87253e76c756a136ff28 (patch)
tree57a0e234258c31d478e557a74ffff2b7095108e3 /cloudinit/sources/__init__.py
parent33cfadd8f35b3f4beb77f871b4173600e42bbe49 (diff)
downloadvyos-cloud-init-92b99b325b2d437825cc87253e76c756a136ff28.tar.gz
vyos-cloud-init-92b99b325b2d437825cc87253e76c756a136ff28.zip
Update so that the content types searched for launch-index
variable has a little more meaning and by default look in metadata for 'launch-index' and have ec2 instead look for a different variable (thus allowing more datasources to just work).
Diffstat (limited to 'cloudinit/sources/__init__.py')
-rw-r--r--cloudinit/sources/__init__.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index d49b67b2..74944e38 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -68,13 +68,18 @@ class DataSource(object):
return self._filter_userdata(self.userdata)
return self.userdata
- def get_launch_index(self):
+ @property
+ def launch_index(self):
+ if not self.metadata:
+ return None
+ if 'launch-index' in self.metadata:
+ return self.metadata['launch-index']
return None
def _filter_userdata(self, processed_ud):
if not processed_ud:
return processed_ud
- idx = self.get_launch_index()
+ idx = self.launch_index
if idx is None:
return processed_ud
# First do a scan to see if any one with launch-index