3

I'm running an Ubuntu 12.04 machine in a very EC2-like environment (Open Stack euca2ools environment).

Basically I launch my instances and give it a GZIPed multipart file as documented here is possible. Here's code for how I convert to multipart file:

write-mime-multipart -z -o multipart.txt.gz \
$PART_HANDLER:text/part-handler \
$IPTXT/serverIP.txt:text/plain \
$CREDS/$CERT.pem:text/plain \
$SCRIPT_DIR/client_script.sh:text/x-shellscript

The problem is that the shell script never executes. I need the other files included before in the mime file before the shell script will work. According to this CloudInit posting, what I'm doing is sound (order-wise).

Anyone know how to get this shell script executing?


EDIT:

I have found this error in my /var/log/cloud-init.log:

Sep 25 22:30:31 server-49412b24-276f [CLOUDINIT] cc_scripts_user.py[WARNING]: failed to run-parts in /var/lib/cloud/instance/scripts
Sep 25 22:30:31 server-49412b24-276f [CLOUDINIT] __init__.py[WARNING]: Traceback (most recent call last):#012  File "/usr/lib/python2.7/dist-packages/cloudinit/CloudConfig/__init__.py", line 117, in run_cc_modules#012    cc.handle(name, run_args, freq=freq)#012  File "/usr/lib/python2.7/dist-packages/cloudinit/CloudConfig/__init__.py", line 78, in handle#012    [name, self.cfg, self.cloud, cloudinit.log, args])#012  File "/usr/lib/python2.7/dist-packages/cloudinit/__init__.py", line 326, in sem_and_run#012    func(*args)#012  File "/usr/lib/python2.7/dist-packages/cloudinit/CloudConfig/cc_scripts_user.py", line 31, in handle#012    util.runparts(runparts_path)#012  File "/usr/lib/python2.7/dist-packages/cloudinit/util.py", line 223, in runparts#012    raise RuntimeError('runparts: %i failures' % failed)#012RuntimeError: runparts: 1 failures

which seems to indicate (of course) that a part of the multipart file was not executed...which isn't exactly helpful in debugging. The script client_script.sh in question runs fine in a terminal.

lollercoaster
  • 15,969
  • 35
  • 115
  • 173
  • but it seems it recognizes your shell script...can you post it here? – cjdcordeiro Sep 27 '13 at 07:13
  • if it is not appropriate to post it here just try to pass just the script to your instance and see if it starts running. I know that the script won't run without the other parts but it will at least start I assume...so just put some output in the beginning and see what happens. If it keeps failing it is a problem with either your script or your cloudinit installation, I would say... :p – cjdcordeiro Sep 27 '13 at 07:23
  • I just tried this, I used a simple script which just does `wget `, but it failed to run as a part of the multipart. – lollercoaster Sep 30 '13 at 16:29
  • but what about alone? the script alone by itself. Because if it fails in that case it means that the CloudInit module for reading and processing user scripts is broken...which has nothing to do with you MIME – cjdcordeiro Oct 01 '13 at 07:21
  • the script by itself functions just fine. so the problem is that cloud-init is not executing the shell file only when its part of a mime multipart – lollercoaster Oct 03 '13 at 00:52
  • hi and sorry for the late reply. I've just tried to create my own mime userdata with a cloud config script and a shell script and everything ran fine...so, sorry but the only thing I could tell you is to reinstall cloudinit or make sure that your write-mime tool is working properly. – cjdcordeiro Oct 22 '13 at 15:40

0 Answers0