Comment 7 for bug 1888822

Revision history for this message
Dan Watkins (oddbloke) wrote : Re: cloud-init caches files and never checks again

Hi Robert, detiber,

Thanks for using cloud-init, for filing a bug, and for the triage! Ryan and I have been chatting on IRC (feel free to join us in #cloud-init on Freenode) and we agree this is a regression. Apologies!

Some older platforms always pass user-data in MIME multipart archives which use "text/x-shellscript" for the part (even if the user is passing "#cloud-config" user-data). The commit you've identified mistakenly means that for every part with a MIME type we know about, we will use the first line of that parts content to determine its type, ignoring the MIME type. The first line of your boothook is "#!", which maps to x-shellscript. This in turn means that it runs later in boot, and everything else falls apart as a result.

The initial fix we've identified is to only use the content to determine the true MIME type if the given MIME type is x-shellscript. This relies on the fact that if an x-shellscript part does not start with a #!, then cloud-init will fail to execute it; it follows that every currently-functional x-shellscript MIME part starts with #!. This means that we will always detect true x-shellscript parts as x-shellscript from their content. And it follows, in turn, that we can safely _always_ use the content of x-shellscript parts to determine their type.

(The reason we cannot do the same for other MIME types is because they do not have the same "detection roundtrip" guarantee.)

In the meantime, if you modify your generated boothook to start with "#cloud-boothook", it will be correctly detected and handled.

Thanks, and apologies, again!

Dan