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/cloud.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/cloud.py')
-rw-r--r-- | cloudinit/cloud.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cloudinit/cloud.py b/cloudinit/cloud.py index 620b3c07..af69a541 100644 --- a/cloudinit/cloud.py +++ b/cloudinit/cloud.py @@ -70,12 +70,15 @@ class Cloud(object): return fn # The rest of thes are just useful proxies - def get_userdata(self): - return self.datasource.get_userdata() + def get_userdata(self, apply_filter=True): + return self.datasource.get_userdata(apply_filter) def get_instance_id(self): return self.datasource.get_instance_id() + def get_launch_index(self): + return self.datasource.get_launch_index() + def get_public_ssh_keys(self): return self.datasource.get_public_ssh_keys() |