summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-07-12 15:51:02 -0400
committerScott Moser <smoser@ubuntu.com>2012-07-12 15:51:02 -0400
commitdd183f1762883168a2a4ed7b8e808ee451992ef9 (patch)
tree86f338d00cb2891379ffba868bce603b8fa6967e /cloudinit
parent265f2c74bb7202c2641b387b5a09c92bbe6563c8 (diff)
downloadvyos-cloud-init-dd183f1762883168a2a4ed7b8e808ee451992ef9.tar.gz
vyos-cloud-init-dd183f1762883168a2a4ed7b8e808ee451992ef9.zip
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.
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/handlers/__init__.py8
1 files changed, 5 insertions, 3 deletions
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