Pass in the datasource as a option, instead of the lower level instance id.

This allows for others to use datasource functions if they desire to instead of being restricted.

+1 for future use ;)
This commit is contained in:
Joshua Harlow
2012-06-16 13:11:22 -07:00
parent 77864b2c43
commit 4cb2327ad0
2 changed files with 5 additions and 3 deletions

View File

@@ -32,10 +32,12 @@ LOG = logging.getLogger(__name__)
class BootHookPartHandler(handlers.Handler): class BootHookPartHandler(handlers.Handler):
def __init__(self, paths, instance_id, **_kwargs): def __init__(self, paths, datasource, **_kwargs):
handlers.Handler.__init__(self, PER_ALWAYS) handlers.Handler.__init__(self, PER_ALWAYS)
self.boothook_dir = paths.get_ipath("boothooks") self.boothook_dir = paths.get_ipath("boothooks")
self.instance_id = instance_id self.instance_id = None
if datasource:
self.instance_id = datasource.get_instance_id()
def list_types(self): def list_types(self):
return [ return [

View File

@@ -287,7 +287,7 @@ class Init(object):
def _default_userdata_handlers(self): def _default_userdata_handlers(self):
opts = { opts = {
'paths': self.paths, 'paths': self.paths,
'instance_id': self.datasource.get_instance_id(), 'datasource': self.datasource,
} }
# TODO Hmmm, should we dynamically import these?? # TODO Hmmm, should we dynamically import these??
def_handlers = [ def_handlers = [