diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-08-26 15:04:06 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-08-26 15:04:06 -0700 |
commit | 6a803e2fba17ab74973038c1a93654c3127c223f (patch) | |
tree | 64872078dd8a74ead5ad82c3e603492da84ac186 /cloudinit/sources/DataSourceEc2.py | |
parent | e345c95b9851ada5062304a9a99364da9abb674b (diff) | |
download | vyos-cloud-init-6a803e2fba17ab74973038c1a93654c3127c223f.tar.gz vyos-cloud-init-6a803e2fba17ab74973038c1a93654c3127c223f.zip |
Add the capability to understand and filter on
userdata based on a launch-index (or leave userdata
alone if none is provided by the datasource). This
works by doing the following.
1. Adjusting the userdata processor to attempt to
inject a "Launch-Index" header into the messages
headers (by either taking a header that already exists
or by looking into the payload to see if it exists
there).
2. Adjust the get_userdata ds function to apply a filter
on the returned userdata (defaulting to false) that
will now use the datasources get_launch_index value
to restrict the 'final' message used in consuming
user data (the same behavior if not existent).
3. Further down the line processes that use the 'resultant'
userdata now will only see the ones for there own launch
index (ie cloud-config will be restricted automatically
and so on) and are unaffected (although they can now
ask the cloud object or the datasource for its launch index
via the above new ds method.
Diffstat (limited to 'cloudinit/sources/DataSourceEc2.py')
-rw-r--r-- | cloudinit/sources/DataSourceEc2.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py index 556dcafb..3e450e7e 100644 --- a/cloudinit/sources/DataSourceEc2.py +++ b/cloudinit/sources/DataSourceEc2.py @@ -77,6 +77,9 @@ class DataSourceEc2(sources.DataSource): self.metadata_address) return False + def get_launch_index(self): + return self.metadata.get('ami-launch-index') + def get_instance_id(self): return self.metadata['instance-id'] |