<div dir="ltr">On 19 February 2015 at 16:33, Grant Schoep <span dir="ltr"><<a href="mailto:matobinder@gmail.com" target="_blank">matobinder@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">So I've been playing around with cloud init scripts for VMs I have been building.<div><br></div><div>I have one example, which I isn't working. Got it from the following</div><div><a href="http://cloudinit.readthedocs.org/en/latest/topics/examples.html" rel="nofollow" target="_blank">http://cloudinit.readthedocs.org/en/latest/topics/examples.html</a><br></div><div><br></div><div>So, its for the reboot/power off section</div><div><br></div><div>I've stripped out my cloud-init to just the basics, taken right from the page. File contents are</div><div><div>power_state:</div><div> delay: "+30"</div><div> mode: poweroff</div><div> message: Bye Bye</div><div> timeout: 30</div></div><div><br></div><div>It doesn't work,  I noticed this line in my /var/log/cloud-init-output.log</div><div><br></div><div>__init__.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: 'power_state:\n delay: "+3...'<br></div><div><br></div><div><br></div><div>So I am thinking I need to define the format. I was looking at</div><div><br></div><div><a href="http://cloudinit.readthedocs.org/en/latest/topics/format.html" target="_blank">http://cloudinit.readthedocs.org/en/latest/topics/format.html</a><br></div><div><br></div><div>But the examples don't seem to show any of that. Pointers would be great. Thanks</div><div><br></div></div></blockquote><div><br>I believe that the issue you have outlined will depend on at least a couple of things:<br><br></div><div>1. cloud-init version<br><br></div><div>You haven't stated the OS distro and versions you are currently using with your instances while the doc links are specific to the latest version of cloud-init (0.7.6 at the time of writing).  The 'power-state-change' module appears to have been added in Nov 2012 (<a href="https://code.launchpad.net/~smoser/cloud-init/finalcmd/+merge/134029">https://code.launchpad.net/~smoser/cloud-init/finalcmd/+merge/134029</a>) - which should have been included in cloud-init 0.7.1, at least according to the timeline on the Launchpad pages and my interpretation thereof :)<br><br></div><div>The reason I mention this is that I know that Ubuntu 12.04 LTS makes use of cloud-init 0.6.3 and similar may be true for other OS distros/versions.<br><br></div><div>2. Inclusion in cloud-init config<br><br></div><div>While I would expect it to appear there by default (it does in Ubuntu 14.04 LTS), and assuming you are making use of cloud-init >= 0.7.1, the instance should have an entry in /etc/cloud/cloud.cfg (under the 'cloud_final_modules' section) for the 'power-state-change' module in order for it to be considered during a run e.g.<br><br># The modules that run in the 'final' stage<br>cloud_final_modules:<br> - rightscale_userdata<br> - scripts-vendor<br> - scripts-per-once<br> - scripts-per-boot<br> - scripts-per-instance<br> - scripts-user<br> - ssh-authkey-fingerprints<br> - keys-to-console<br> - phone-home<br> - final-message<br> - power-state-change<br><br></div><div>Naturally, if the module is not included it will not be considered.<br><br></div><div>I hope that one of those is the pointer you were looking for.<br><br></div><div>Regards,<br><br>--<br></div><div>Adnan<br></div></div></div></div>