diff options
author | Scott Moser <smoser@ubuntu.com> | 2012-03-12 14:56:35 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-03-12 14:56:35 -0400 |
commit | eefca80065bf9cae734022c0665aa8ffbf3ee81e (patch) | |
tree | c6e9416c6de0b07812e53093bc6fef9688809d11 /cloudinit/__init__.py | |
parent | 430f0fc7fb0b2472ced13785e3a6b5785e304e16 (diff) | |
parent | c1a006bb9ee915c08075e9adeab245f02452ee43 (diff) | |
download | vyos-cloud-init-eefca80065bf9cae734022c0665aa8ffbf3ee81e.tar.gz vyos-cloud-init-eefca80065bf9cae734022c0665aa8ffbf3ee81e.zip |
Warn in user-data processing on non-multipart, non-handled data
If user-data is supplied that is not multipart, and is unhandled, then
log a warning. A warning by default will get to the console, so the user
can see it even if they cannot get into the instance. If they don't see
it there, it would still be available in the cloud-init log.
Diffstat (limited to 'cloudinit/__init__.py')
-rw-r--r-- | cloudinit/__init__.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cloudinit/__init__.py b/cloudinit/__init__.py index 37447a31..3168a632 100644 --- a/cloudinit/__init__.py +++ b/cloudinit/__init__.py @@ -606,6 +606,14 @@ def partwalker_callback(pdata, ctype, filename, payload): partwalker_handle_handler(pdata, ctype, filename, payload) return if ctype not in pdata['handlers']: + if ctype == "text/x-not-multipart": + # Extract the first line or 24 bytes for displaying in the log + start = payload.split("\n", 1)[0][:24] + if start < payload: + details = "starting '%s...'" % start.encode("string-escape") + else: + details = repr(payload) + log.warning("Unhandled non-multipart userdata %s", details) return handler_handle_part(pdata['handlers'][ctype], pdata['data'], ctype, filename, payload, pdata['frequency']) |