From c9c3de2fad73af119cf9002799a875c71fda7b7a Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sat, 16 Jun 2012 13:06:02 -0700 Subject: When a handler version is set but to an unknown non-int convertable value, treat it as 1 --- cloudinit/handlers/__init__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'cloudinit/handlers') diff --git a/cloudinit/handlers/__init__.py b/cloudinit/handlers/__init__.py index afa9ec3b..156e228d 100644 --- a/cloudinit/handlers/__init__.py +++ b/cloudinit/handlers/__init__.py @@ -98,11 +98,18 @@ def run_part(mod, data, ctype, filename, payload, frequency): (frequency == PER_INSTANCE and mod_freq == PER_INSTANCE)): return mod_ver = mod.handler_version + # Sanity checks on version (should be an int convertable) try: - if mod_ver == 1: - mod.handle_part(data, ctype, filename, payload) - else: + mod_ver = int(mod_ver) + except: + mod_ver = None + try: + if mod_ver and mod_ver >= 2: + # Treat as v. 2 which does get a frequency mod.handle_part(data, ctype, filename, payload, frequency) + else: + # Treat as v. 1 which gets no frequency + mod.handle_part(data, ctype, filename, payload) except: util.logexc(LOG, ("Failed calling handler %s (%s, %s, %s)" " with frequency %s"), -- cgit v1.2.3