New Question

user_data in MultipartMime is base64 encoded

asked 2017-06-07 12:35:57 +0300

dev-rowbot gravatar image


Using HEAT Templating. I am trying to make use of OS::Heat::MultipartMime to send a Powershell script and PEM certificate as user_data.

My initial yaml file can be found here:

My script is based on these examples:

The problem I am having is that no matter what I subtype I set for the Powershell script, it is always base64 encoded and it is not executed by Cloudbase-Init. Please see the debug log for more info -->

I have tried setting the subtype to both x-shellscript and x-cfninitdata. With x-shellscript defined clousbase-init attempts to execute the script but does not decode it before execution and the execution fails.

I can get the script working if I "inline" the data and do not use MultipartMime:

My goal is to pass the certificate (to be used by the WinRM plugin) and a few shell scripts (to configure services and add this host to the domain) to the Windows Instance but I cannot find any examples of this.

Is this possible?

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2017-06-09 17:40:14 +0300

avladu gravatar image

Hello again, Can you try this CloudbaseInit beta installer and check if your problem is solved? Here is the patch in review: Thanks.

edit flag offensive delete link more


Hi Adrian, Just realised I had not marked this as fixed. I have used the beta installer a couple times with no further issues. Do you know when this will become official?

dev-rowbot gravatar imagedev-rowbot ( 2017-06-19 16:07:18 +0300 )edit

The patch is already under review and soon enough, it will be merged in the main repo. Please check for the status. Thank you!

avladu gravatar imageavladu ( 2017-06-19 17:29:49 +0300 )edit

answered 2017-06-07 13:46:36 +0300

avladu gravatar image


The heat multipart mime has only one entry point - think about it like a int main(void) function in C - only one script that gets executed. It is mandatory to have it defined as here, where the filename is called cfn-userdata and its subtype is x-cfninitdata.

For the moment, there is no multipart type where you can put the content of a WinRM to be mapped certificate.There is already a bug opened on this, which refers to a similar scenario. If you have the same problem, we can open a feature request (blueprint) and start working on it.

A solution for the certificate is to write your own code in the main script that imports/maps the certificate.

Thank you,
Adrian Vladu

edit flag offensive delete link more


Hi Adrian I have defined my MultipartMime as per the AD Controller example but unfortunately the behaviour is the same. Debug -> The cfn-userdata is still base64 encoded and I can see this WARNING in the debug log: Unsupported user_data format

dev-rowbot gravatar imagedev-rowbot ( 2017-06-07 15:05:42 +0300 )edit

Thanks for the logs. In order to try to reproduce your issue, what OpenStack version do you use?

avladu gravatar imageavladu ( 2017-06-07 15:37:18 +0300 )edit

the only diff I see is your heat_template_version. can you try using heat_template_version: 2013-05-23?

avladu gravatar imageavladu ( 2017-06-07 15:43:02 +0300 )edit

We are using the stable/ocata branch, tag version 15.1.3

dev-rowbot gravatar imagedev-rowbot ( 2017-06-07 15:45:29 +0300 )edit

I get the same result using the 2013-05-23 template version. Does cloudbase-init decode the content when the mime Content-Transfer-Encoding is base64?

dev-rowbot gravatar imagedev-rowbot ( 2017-06-07 16:05:44 +0300 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower


Asked: 2017-06-07 12:35:57 +0300

Seen: 31 times

Last updated: Jun 07