Created
October 4, 2011 11:44
-
-
Save benbc/1261440 to your computer and use it in GitHub Desktop.
Problem getting cloud-init part handler to run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Content-Type: multipart/mixed; boundary="===============1189832017==" | |
MIME-Version: 1.0 | |
--===============1189832017== | |
Content-Type: text/plain; charset="us-ascii" | |
MIME-Version: 1.0 | |
Content-Transfer-Encoding: 7bit | |
Content-Disposition: attachment; filename="bootstrap.pp" | |
package {'tree': ensure => installed} | |
--===============1189832017== | |
Content-Type: text/x-shellscript; charset="us-ascii" | |
MIME-Version: 1.0 | |
Content-Transfer-Encoding: 7bit | |
Content-Disposition: attachment; filename="bootstrap.sh" | |
#!/bin/sh -eu | |
pwd | |
apt-get --quiet update | |
apt-get --quiet --yes install puppet | |
puppet apply /tmp/bootstrap.pp | |
--===============1189832017== | |
Content-Type: text/part-handler; charset="us-ascii" | |
MIME-Version: 1.0 | |
Content-Transfer-Encoding: 7bit | |
Content-Disposition: attachment; filename="part_handler.py" | |
#part-handler | |
def list_types(): | |
return(["text/plain"]) | |
def handle_part(data, ctype, filename, payload): | |
if ctype == "__begin__": | |
return | |
if ctype == "__end__": | |
return | |
print "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& here I am!" | |
with open('/tmp/'+filename, 'w') as f: | |
f.write(payload) | |
--===============1189832017==-- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment