summaryrefslogtreecommitdiff
path: root/cloudinit/user_data.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/user_data.py')
-rw-r--r--cloudinit/user_data.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py
index 67bdf981..f234b962 100644
--- a/cloudinit/user_data.py
+++ b/cloudinit/user_data.py
@@ -126,8 +126,12 @@ class UserDataProcessor(object):
# Attempt to figure out the payloads content-type
if not ctype_orig:
ctype_orig = UNDEF_TYPE
- if ctype_orig in TYPE_NEEDED or (ctype_orig in
- INCLUDE_MAP.values()):
+ # There are known cases where mime-type text/x-shellscript included
+ # non shell-script content that was user-data instead. It is safe
+ # to check the true MIME type for x-shellscript type since all
+ # shellscript payloads must have a #! header. The other MIME types
+ # that cloud-init supports do not have the same guarantee.
+ if ctype_orig in TYPE_NEEDED + ['text/x-shellscript']:
ctype = find_ctype(payload)
if ctype is None:
ctype = ctype_orig