If I add additional scripts on top of template builder are they going to be executed in order or is the solution more complex than this?
Something like: templateBuilder.wrapInInitScript(false).runScript(installBashAndSudo()) .wrapInitScript(true).runScript(everythingElse()) On 27. 01. 2016 10:56, Ignasi Barrera wrote: > Yes, the RunScriptOptions provide options to run the scripts as root, > and also to explicitly disable sudo. > > Currently the wrapper script requires bash, so you'll have to install > it first if you need to use it. You could split the runscript in two > operations: a first one with the wrapInitScript(false) to just install > bash, and a second one to run the desired script. > > That wrapper script, as said, contains several helpers to let jclouds > query the status of the script execution: see if it is still running, > allow to abort it, etc. If you are running scripts that take time, I'd > recommend you run them with the wrapper script. > > I. > > On 27 January 2016 at 10:48, Klemen Ferjančič <[email protected]> wrote: >> Good advice, I suspect I know what is going on. >> >> Home directory contains bootstrap and /tmp/init-bootstrap exists. >> However, if I run ./init-bootstrap it says "not found". I checked the >> init script and it seems that bash is expected to exist on the system >> (#!/bin/bash), however, bash does not come preinstalled on FreeBSD. I >> could install bash with runScript but I don't think personal script is >> executed before the init one? Another interesting note: sudo is not >> preinstalled either so I probably need to run my script as root. I'll >> play around with this and see what I can do. >> >> Code snippet: >> >> templateBuilder.osFamily(OsFamily.FREEBSD); >> templateBuilder.imageId(REGION + "/ami-9f5549f3"); >> EC2TemplateOptions o = EC2TemplateOptions.Builder.keyPair("mykeypair") >> .overrideLoginCredentials(getLoginForCommandExecution(os)).runScript(getBootInstructions(os)); >> templateBuilder.locationId(REGION); >> templateBuilder.hardwareId(INSTANCE); >> templateBuilder.options(o); >> >> >> On 27. 01. 2016 10:23, Ignasi Barrera wrote: >>> Hi Klemen, >>> >>> jclouds generates and uploads that script to the node. It is a wrapper >>> script that provides some helpers to get the status of the configured >>> script, and to properly capture the output, stderr, and make it >>> possible to abort its execution. >>> >>> After the failure, can you log in to the instance and see which files >>> do you have in the user's home directory and in /tmp? >>> >>> You can also disable the wrapper script by configuring the >>> "wrapInitScript(false)" in the RunScriptOptions, and see if the >>> problem persists. >>> >>> Could you also share a small code snippet of the code you're using to >>> bootstrap the node? >>> >>> I. >>> >>> On 27 January 2016 at 09:39, Klemen Ferjančič <[email protected]> wrote: >>>> Hi >>>> >>>> When I create a new Ec2 instance with FreeBSD private AMI, the >>>> init-bootstrap fails to run. The instance is created and runs normally, >>>> but the error also fails my own runScript so I'd like to resolve it. >>>> >>>> 00:32:27,588 ERROR [jclouds.compute] (user thread 0) << problem >>>> customizing node(eu-central-1/i-22cd4c9e): : >>>> java.lang.IllegalStateException: error running [/tmp/init-bootstrap >>>> init] as [email protected]; returnVal !=0: >>>> {output=/tmp/init-bootstrap: not found >>>> , error=, exitStatus=127) >>>> >>>> Full stacktrace: http://pastebin.com/xabqprs5 >>>> >>>> 1. Is /tmp/init-bootstrap supposed to already exist on the image or is >>>> this a script that jclouds uploads to the node? If the latter, I assume >>>> there is a problem with script not being uploaded in the first place? No >>>> error indicates this though. >>>> 2. What does this script actually do? Is it possible to disable it? >>>> >>>> Best regards, Klemen >>>> >>>> >>
signature.asc
Description: OpenPGP digital signature
