diff options
author | Scott Moser <smoser@ubuntu.com> | 2010-07-01 20:53:28 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2010-07-01 20:53:28 -0400 |
commit | 422f55437a773bf1896aa0d329f9079d885c5b62 (patch) | |
tree | 0bc1cb60b6c3e1c10229951e77f84f2dc1ad7762 /cloudinit/UserDataHandler.py | |
parent | 5b03431c163ebd3e0df26a304ad9386817fcb35c (diff) | |
download | vyos-cloud-init-422f55437a773bf1896aa0d329f9079d885c5b62.tar.gz vyos-cloud-init-422f55437a773bf1896aa0d329f9079d885c5b62.zip |
resort to "starts with" to find mime type only on plain/text (LP: #600799)
The starts-with determination of mime type was overriding an explicit
setting in the mime-type. This was evident when the mime type specified
boothook, but the content began with '#!'. In that case, the content
would run as a user script rather than boothook.
LP: #600799
Diffstat (limited to 'cloudinit/UserDataHandler.py')
-rw-r--r-- | cloudinit/UserDataHandler.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cloudinit/UserDataHandler.py b/cloudinit/UserDataHandler.py index 5c95173a..ab7d0bc8 100644 --- a/cloudinit/UserDataHandler.py +++ b/cloudinit/UserDataHandler.py @@ -65,13 +65,15 @@ def process_includes(msg,parts): payload = part.get_payload() ctype = None - for str, gtype in starts_with_mappings.items(): - if payload.startswith(str): - ctype = gtype - break + ctype_orig = part.get_content_type() + if ctype_orig == "text/plain": + for str, gtype in starts_with_mappings.items(): + if payload.startswith(str): + ctype = gtype + break if ctype is None: - ctype = part.get_content_type() + ctype = ctype_orig if ctype == 'text/x-include-url': do_include(payload,parts) |