← Back to team overview

openstack team mailing list archive

Sending userdata during server create via api's

 

Hi,

I've posted on this previously but have yet to be pointed in the right direction - so I'm posting again.  Examples or docs appreciated.

I'm trying to pass user_data on server create using the xml (or JSON) api. 

My userdata looks like...
"#!/bin/bash
#
#Purpose : Setup the initial image

set -e -x
export DEBIAN_FRONTEND=noninteractive

apt-get update && apt-get upgrade -y
...

I am base64 UTF-8 encoding the string and I've tried sending it as a message part, a query string on the url and as a post parameter. This works from the Horizon UI, but I get...

2012-06-18 19:58:18,610 - __init__.py[WARNING]: Unhandled non-multipart userdata ''"

when I try to pass via xml. The only thing I haven't tried is a different extension namespace on the user_data element if passing it that way, but I can't see any docs on this.

Here is an example of one of the configurations I tried...

<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="http://docs.openstack.org/compute/api/v1.1"; name="server8" imageRef="http://192.168.75.70:8774/30ddcb35079f406eae98857515cbf1d2/images/57443c48-eb29-48f6-853a-b8bc7d5dde05"; flavorRef="1" user_data="IyEvYmluL2Jhc2gNCiMNCiNBdXRob3IgOiBFZCBzaGF3DQojRGF0ZSA6IDE0IEp1biAxMg0KI1B1cnBvc2UgOiBTZXR1cCB0aGUgaW5pdGlhbCBpbWFnZQ0KI0NvbW1lbnRzIDoNCiMNCiMgTGFzdCBFZGl0dGVkIGJ5OiBlZHNoYXcNCg0Kc2V0IC1lIC14DQpleHBvcnQgREVCSUFOX0ZST05URU5EPW5vbmludGVyYWN0aXZlDQoNCmFwdC1nZXQgdXBkYXRlICYmIGFwdC1nZXQgdXBncmFkZSAteQ0KYXB0LWdldCAteSBpbnN0YWxsIGFwYWNoZTINCg0KI1NlbmQgdG8gY29uc29sZSB3ZSBmaW5pc2hlZCBydW5uaW5nLg0KZWNobyAiTkVYSkNPTkZJRzogSW5zdGFuY2Ugc2V0dXAgc3VjY2Vzc2Z1bHkgZXhlY3V0ZWQuIiA"/>

I'm looking for a sample payload that works so I can fashion my xml after it.

Thanks,

Ed


Follow ups