Clint, Scott - sorry about the late reply. I did not explain myself particularly well. Here's another attempt. The CloudInit documentation section for "Multipart Input" states "[a] single format of user data might not be enough to accomplish what you want. For example, you may want to insert an upstart job and also run a user-data script." The example provided is:
$ ls my-boothook.txt my-include.txt my-user-script.txt my-cloudconfig.txt my-upstart-job.txt $ write-mime-multipart --output=combined-userdata.txt \ my-boothook.txt:text/cloud-boothook \ my-include.txt:text/x-include-url \ my-upstart-job.txt:text/upstart-job \ my-user-script.txt:text/x-shellscript \ my-cloudconfig.txt Is the order of execution of the various parts deterministic? Can the order of execution be controlled in any manner, e.g. can I specify that "my-include.txt" depends on "my-user-script.txt" finishing? A rather contrived use-case is if my-cloudconfig.txt was used to create some users and my-include.txt performed some operation on those users' home directories. Another case is described in my original note. > To control order in which user-data is processed you should just need to > control the order in which it is created. Does this mean that the order in which the parts are specified in the invokation of "write-mime-multipart" above determines the order in which the parts gets executed? Is execution serial (my observations lean toward no here)? On Tue, Feb 12, 2013 at 4:16 PM, Scott Moser <smo...@ubuntu.com> wrote: > On Mon, 11 Feb 2013, Bo Shi wrote: > >> Hi Folks, >> >> Is there a way to ensure that a particular custom part-handler is run >> as the very last component to execute? >> > > In multipart input, part-handlers > * the method 'handle_part' with signature (data,ctype,filename,payload) > is the handler > * execute the handler initialization (cdata=__begin__) in the order they > are found, > * replace any existing handlers for the types they claim > * will immediately start handling any subsequent parts of the > type they're registered for. > * have handle_part called with cdata='__end__' called in undefined order > after all user-data content has been handled. > >> We use EC2 UserData (augmented via Ubuntu's CloudInit) to install >> dependencies and have a relatively generic script to invoke >> ec2-bundle-vol. Due to us not being terribly sophisticated in >> controlling the part execution order of our multi-part UserData, we're >> somewhat constrained on the CloudInit features we can use. It would >> be straightforward to convert it to a part-handler plugin but, of >> course, this particular handler would have to execute last. > > So, I'm kind of confused as to what "execute last" means here. > Where you wanting defined execution order of the handle_part with > 'cdata=__end__'. > > To control order in which user-data is processed you should just need to > control the order in which it is created. > > Does that make sense? -- Ubuntu-cloud mailing list Ubuntu-cloud@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-cloud