diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-21 17:15:45 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-21 17:15:45 -0700 |
commit | 155fa982b895b70572857ab25a324809470d74b3 (patch) | |
tree | aa15a02bdc8f8494fa8db7d25659ef2128b67e45 /cloudinit/handlers | |
parent | 51181b8540372b9b83bbab51cae548992c497682 (diff) | |
download | vyos-cloud-init-155fa982b895b70572857ab25a324809470d74b3.tar.gz vyos-cloud-init-155fa982b895b70572857ab25a324809470d74b3.zip |
1. Only register and increment the handler count after we have ensured it imports and call_begin passes.
2. Fixup the 'test__init__.py' file to now be working again.
Diffstat (limited to 'cloudinit/handlers')
-rw-r--r-- | cloudinit/handlers/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cloudinit/handlers/__init__.py b/cloudinit/handlers/__init__.py index 94cb699e..20a822bd 100644 --- a/cloudinit/handlers/__init__.py +++ b/cloudinit/handlers/__init__.py @@ -135,12 +135,15 @@ def walker_handle_handler(pdata, _ctype, _filename, payload): modfname = "%s.py" % (modfname) # TODO: Check if path exists?? util.write_file(modfname, payload, 0600) - pdata['handlercount'] = curcount + 1 handlers = pdata['handlers'] try: mod = fixup_handler(importer.import_module(modname)) - handlers.register(mod) call_begin(mod, pdata['data'], frequency) + # Only register and increment + # after the above have worked (so we don't if it + # fails) + handlers.register(mod) + pdata['handlercount'] = curcount + 1 except: util.logexc(LOG, ("Failed at registering python file: %s" " (part handler %s)"), modfname, curcount) |