@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(); }
@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(); }