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:
		@@ -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 [
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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 = [
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user