Hi all, I committed all changes did for using a customization script to pass payloads to VMs.
Please note that I used the property name "shellType", not the "shell_type" as discussed. Now when spawning an instance for vCloud, the relevant script file is read and the "PAYLOAD" string will be replaced by the actual payload being passed. For example: repository/conf/scripts/*sh*/*customization* #!/bin/sh mkdir -p /tmp/payload echo "PAYLOAD" > /tmp/payload/launch-params /root/bin/init-vcloud.sh Note that I call the init-vcloud.sh script from the customization script itself, unlike in EC2/OpenStack where we execute the init script from /etc/rc.local. The reason for this is that we need to make sure the init is executed only after the payload values were written to the temp file. I'm working on testing some cartridges on vCloud now. Thanks! Best Regards, On Wed, Mar 19, 2014 at 10:40 AM, Isuru Perera <isu...@wso2.com> wrote: > Hi all, > > I'm going put these scripts into repository/conf and the "customization" > script will be under a specific shell_type directory. > > The name "customization" will be a constant. > > For example, for "sh" > > repository/conf/scripts/*sh*/*customization* > > > > > On Fri, Mar 14, 2014 at 7:01 PM, Isuru Perera <isu...@wso2.com> wrote: > >> An update on my effort: >> >> I was trying to get the customization script working on vCloud and it was >> not working. >> >> I just figured out the issue. >> >> The script on Ubuntu is invoked via "sh" and I was trying the following >> sample script to test. >> >> #!/bin/bash >> echo $1 >> mkdir /root/isurutest >> if [ x$1 == x"precustomization" ]; then >> echo "Do Precustomization tasks " `date` > pretasks >> elif [ x$1 == x"postcustomization" ]; then >> echo "Do Postcustomization tasks " `date` > posttasks >> fi >> >> So this script gives an error. >> >> precustomization >> /root/.customization/customize.sh: 4: [: xprecustomization: unexpected >> operator >> /root/.customization/customize.sh: 6: [: xprecustomization: unexpected >> operator >> >> The customization script log can be found at >> /var/log/vmware-imc/customization.log >> >> The script is saved at /root/.customization/customize.sh >> >> I should make sure that the script is working with "sh". >> >> Also the script will not be updated even if we change it from VMware >> vCloud Director interface. I hope this won't be a problem when spawning the >> instance via jclouds. >> >> Now that I found out how customization script works, I will go ahead do >> the code changes. >> >> Thanks! >> >> Best Regards, >> >> >> On Fri, Mar 14, 2014 at 6:50 PM, Isuru Perera <isu...@wso2.com> wrote: >> >>> Hi Shaheed, >>> >>> Thanks for the suggestion. >>> >>> The plan is to use the customization script and send the payload to >>> vCloud VM. Then we plan to configure the base image to read those payload >>> and run puppet agent etc. >>> >>> >>> On Thu, Mar 13, 2014 at 2:37 PM, Shaheed Haque <shahh...@cisco.com>wrote: >>> >>>> >>>> >>>> >>>> >>>> Please ensure that Python2 and Python3 are possible options! >>>> >>>> >>>> >>>> (If nothing else, we probably want to encourage people towards these >>>> higher layers rather than bash/cmd/etc.) >>>> >>>> >>>> >>>> >>>> >>>> On Thursday 13 March 2014 11:28:36 Isuru Perera wrote: >>>> >>>> Planning to implement following solution. >>>> >>>> 1. Define "shell_type" as a property in Cartridge Definition. Possible >>>> values can be "bash", "sh", "cmd", etc. >>>> >>>> 2. Dynamically create a customization script based on "shell_type" in >>>> vCloud IaaS implementation. >>>> >>>> I will try to implement this in an extensible way (without code >>>> modifications) for any shell_type. >>>> >>>> Thanks! >>>> >>>> Best Regards, >>>> >>>> >>>> >>>> >>>> On Thu, Mar 13, 2014 at 10:32 AM, Isuru Perera <isu...@wso2.com> wrote: >>>> >>>> Thanks Udara for the information. >>>> >>>> So, it seems we have to go ahead with the use of customization script >>>> in vCloud. >>>> >>>> Next problem is that the script is dependent on the target Cartridge OS. >>>> >>>> Please let me know if you have any suggestions to solve this problem. >>>> >>>> >>>> >>>> On Thu, Mar 13, 2014 at 7:44 AM, Udara Liyanage <ud...@wso2.com> wrote: >>>> >>>> AFIR the metadata is read by a init script inside the instance, not the >>>> cartridge agent. >>>> In EC2 and Openstack we can pass the user data using jclouds API. >>>> However it can not be done in VCloud scenario. In VCloud custom metadata >>>> can be stored in VApp. However in order retrieve username/password are >>>> needed. >>>> >>>> I'v written to some blog post where they suggest to go via script as >>>> Isuru is trying. >>>> >>>> >>>> >>>> Touched, not typed. Erroneous words are a feature, not a typo. >>>> >>>> >>>> >>>> >>>> -- >>>> >>>> Isuru Perera >>>> Senior Software Engineer | WSO2, Inc. | http://wso2.com/ >>>> Lean . Enterprise . Middleware >>>> >>>> about.me/chrishantha >>>> >>>> >>>> >>>> >>>> -- >>>> >>>> Isuru Perera >>>> Senior Software Engineer | WSO2, Inc. | http://wso2.com/ >>>> Lean . Enterprise . Middleware >>>> >>>> about.me/chrishantha >>>> >>>> >>>> >>>> >>> >>> >>> -- >>> Isuru Perera >>> Senior Software Engineer | WSO2, Inc. | http://wso2.com/ >>> Lean . Enterprise . Middleware >>> >>> about.me/chrishantha >>> >> >> >> >> -- >> Isuru Perera >> Senior Software Engineer | WSO2, Inc. | http://wso2.com/ >> Lean . Enterprise . Middleware >> >> about.me/chrishantha >> > > > > -- > Isuru Perera > Senior Software Engineer | WSO2, Inc. | http://wso2.com/ > Lean . Enterprise . Middleware > > about.me/chrishantha > -- Isuru Perera Senior Software Engineer | WSO2, Inc. | http://wso2.com/ Lean . Enterprise . Middleware about.me/chrishantha