summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 20:16:26 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 20:16:26 -0700
commit005ff658c6f301303269e14dfef4c27ada5c3982 (patch)
tree00475bbe622ee0ad087df67c9bbb5098669d9f28
parent0bfb3f5e5b4475c1dcbdb5db95bfce97d97ffc6a (diff)
downloadvyos-cloud-init-005ff658c6f301303269e14dfef4c27ada5c3982.tar.gz
vyos-cloud-init-005ff658c6f301303269e14dfef4c27ada5c3982.zip
1. Ensure a that when a bad version is found, that it gets set to 1.
2. Increment part handler count even if it doesn't get registered (this shouldn't cause any problems)
-rw-r--r--cloudinit/handlers/__init__.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/cloudinit/handlers/__init__.py b/cloudinit/handlers/__init__.py
index 156e228d..0ef704f7 100644
--- a/cloudinit/handlers/__init__.py
+++ b/cloudinit/handlers/__init__.py
@@ -102,7 +102,7 @@ def run_part(mod, data, ctype, filename, payload, frequency):
try:
mod_ver = int(mod_ver)
except:
- mod_ver = None
+ mod_ver = 1
try:
if mod_ver and mod_ver >= 2:
# Treat as v. 2 which does get a frequency
@@ -134,12 +134,12 @@ 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)
- pdata['handlercount'] = curcount + 1
except:
util.logexc(LOG, "Failed at registered python file: %s", modfname)