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.
This commit is contained in:
Joshua Harlow
2012-08-26 15:04:06 -07:00
parent 540a79622d
commit 9fbec57535
5 changed files with 90 additions and 21 deletions

View File

@@ -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()