@Override public RunScriptOnNode create( NodeMetadata node, Statement runScript, RunScriptOptions options) { checkNotNull(node, "node"); checkNotNull(runScript, "runScript"); checkNotNull(options, "options"); return !options.shouldWrapInInitScript() ? factory.exec(node, runScript, options) : (options.shouldBlockOnComplete() ? factory.backgroundAndBlockOnComplete(node, runScript, options) : factory.background(node, runScript, options)); }
@Override public BlockUntilInitScriptStatusIsZeroThenReturnOutput submit( NodeMetadata node, Statement script, RunScriptOptions options) { checkNotNull(node, "node"); checkNotNull(script, "script"); checkNotNull(options, "options"); options.shouldWrapInInitScript(); return factory.backgroundAndBlockOnComplete(node, script, options).init().future(); }
@AssistedInject public RunScriptOnNodeAsInitScriptUsingSsh( Function<NodeMetadata, SshClient> sshFactory, @Assisted NodeMetadata node, @Assisted Statement script, @Assisted RunScriptOptions options) { this.sshFactory = checkNotNull(sshFactory, "sshFactory"); this.node = checkNotNull(node, "node"); String name = options.getTaskName(); if (name == null) { if (checkNotNull(script, "script") instanceof InitBuilder) name = InitBuilder.class.cast(script).getInstanceName(); else name = "jclouds-script-" + System.currentTimeMillis(); } this.init = checkNotNull(script, "script") instanceof InitBuilder ? InitBuilder.class.cast(script) : createInitScript(name, script); this.initFile = String.format(initScriptPattern, name); this.runAsRoot = options.shouldRunAsRoot(); }
@AssistedInject public RunScriptOnNodeUsingSsh( Function<NodeMetadata, SshClient> sshFactory, EventBus eventBus, @Assisted NodeMetadata node, @Assisted Statement statement, @Assisted RunScriptOptions options) { this.sshFactory = checkNotNull(sshFactory, "sshFactory"); this.eventBus = checkNotNull(eventBus, "eventBus"); this.node = checkNotNull(node, "node"); this.statement = checkNotNull(statement, "statement"); this.runAsRoot = options.shouldRunAsRoot(); }