summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 13:11:22 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 13:11:22 -0700
commit457b9998d760150efb17658f9a0fd4816417577e (patch)
treeb4121011612b16b905ada79777f26346d78350b1
parentc9c3de2fad73af119cf9002799a875c71fda7b7a (diff)
downloadvyos-cloud-init-457b9998d760150efb17658f9a0fd4816417577e.tar.gz
vyos-cloud-init-457b9998d760150efb17658f9a0fd4816417577e.zip
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 ;)
-rw-r--r--cloudinit/handlers/boot_hook.py6
-rw-r--r--cloudinit/stages.py2
2 files changed, 5 insertions, 3 deletions
diff --git a/cloudinit/handlers/boot_hook.py b/cloudinit/handlers/boot_hook.py
index 10f60b8d..fa675f09 100644
--- a/cloudinit/handlers/boot_hook.py
+++ b/cloudinit/handlers/boot_hook.py
@@ -32,10 +32,12 @@ LOG = logging.getLogger(__name__)
class BootHookPartHandler(handlers.Handler):
- def __init__(self, paths, instance_id, **_kwargs):
+ def __init__(self, paths, datasource, **_kwargs):
handlers.Handler.__init__(self, PER_ALWAYS)
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):
return [
diff --git a/cloudinit/stages.py b/cloudinit/stages.py
index 8fa9d6d3..2931830c 100644
--- a/cloudinit/stages.py
+++ b/cloudinit/stages.py
@@ -287,7 +287,7 @@ class Init(object):
def _default_userdata_handlers(self):
opts = {
'paths': self.paths,
- 'instance_id': self.datasource.get_instance_id(),
+ 'datasource': self.datasource,
}
# TODO Hmmm, should we dynamically import these??
def_handlers = [