From dd183f1762883168a2a4ed7b8e808ee451992ef9 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 12 Jul 2012 15:51:02 -0400 Subject: walker_callback: fix traceback on empty payload. A previous commit of mine here tried to apply a trivial fix to avoid a warning on empty content type. Instead, it made the empty content type call a handler which did not exist. This instead logs warning on unknown non-empty payload. It logs debug on empty payload. --- cloudinit/handlers/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cloudinit/handlers') diff --git a/cloudinit/handlers/__init__.py b/cloudinit/handlers/__init__.py index dce2abef..6d1502f4 100644 --- a/cloudinit/handlers/__init__.py +++ b/cloudinit/handlers/__init__.py @@ -165,7 +165,10 @@ def walker_callback(pdata, ctype, filename, payload): walker_handle_handler(pdata, ctype, filename, payload) return handlers = pdata['handlers'] - if ctype not in pdata['handlers'] and payload: + if ctype in pdata['handlers']: + run_part(handlers[ctype], pdata['data'], ctype, filename, + payload, pdata['frequency']) + elif payload: # Extract the first line or 24 bytes for displaying in the log start = _extract_first_or_bytes(payload, 24) details = "'%s...'" % (start.encode("string-escape")) @@ -176,8 +179,7 @@ def walker_callback(pdata, ctype, filename, payload): LOG.warning("Unhandled unknown content-type (%s) userdata: %s", ctype, details) else: - run_part(handlers[ctype], pdata['data'], ctype, filename, - payload, pdata['frequency']) + LOG.debug("empty payload of type %s" % ctype) # Callback is a function that will be called with -- cgit v1.2.3