New Question
0

user_data in MultipartMime is base64 encoded

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

dev-rowbot gravatar image

Hi,

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: https://pastebin.com/29tqUnPR

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 --> https://pastebin.com/cSFTP4ae

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: https://pastebin.com/DZB1vy9F

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
0

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? https://www.dropbox.com/s/151it4wfmrgtdww/CloudbaseInitSetup_base64_mime_fix_1dc8f1cb1e70e58b4774d4c5dcbcef848f69d318.msi Here is the patch in review: https://review.openstack.org/#/c/472649/ Thanks.

edit flag offensive delete link more

Comments

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 https://review.openstack.org/#/c/472649/ for the status. Thank you!

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

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

avladu gravatar image

Hello,

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

Comments

Hi Adrian I have defined my MultipartMime as per the AD Controller example but unfortunately the behaviour is the same. Debug -> https://pastebin.com/by1pkRj3 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

Question Tools

1 follower

Stats

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

Seen: 46 times

Last updated: Jun 07