summaryrefslogtreecommitdiff
path: root/cloudinit/__init__.py
diff options
context:
space:
mode:
authorMike Milner <mike.milner@canonical.com>2012-02-21 15:26:08 -0400
committerMike Milner <mike.milner@canonical.com>2012-02-21 15:26:08 -0400
commit8b17caade46cf84050961e24a0006386dbe96669 (patch)
tree09a112e9f23ed581e21e32df8cf36194f1fb5f48 /cloudinit/__init__.py
parent149e58e715dba9c6c332ac12ddc4cca6609cbb41 (diff)
downloadvyos-cloud-init-8b17caade46cf84050961e24a0006386dbe96669.tar.gz
vyos-cloud-init-8b17caade46cf84050961e24a0006386dbe96669.zip
Add test and fix for catching exceptions.
Diffstat (limited to 'cloudinit/__init__.py')
-rw-r--r--cloudinit/__init__.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/cloudinit/__init__.py b/cloudinit/__init__.py
index 7a34e053..4338b46f 100644
--- a/cloudinit/__init__.py
+++ b/cloudinit/__init__.py
@@ -572,10 +572,14 @@ def handler_handle_part(mod, data, ctype, filename, payload, frequency):
if not (modfreq == per_always or
(frequency == per_instance and modfreq == per_instance)):
return
- if mod.handler_version == 1:
- mod.handle_part(data, ctype, filename, payload)
- else:
- mod.handle_part(data, ctype, filename, payload, frequency)
+ try:
+ if mod.handler_version == 1:
+ mod.handle_part(data, ctype, filename, payload)
+ else:
+ mod.handle_part(data, ctype, filename, payload, frequency)
+ except:
+ util.logexc(log)
+ traceback.print_exc(file=sys.stderr)
def partwalker_handle_handler(pdata, _ctype, _filename, payload):
@@ -594,7 +598,6 @@ def partwalker_handle_handler(pdata, _ctype, _filename, payload):
except:
util.logexc(log)
traceback.print_exc(file=sys.stderr)
- return
def partwalker_callback(pdata, ctype, filename, payload):