@Override public TemplateOptions wrapInInitScript(boolean wrapInInitScript) { return TemplateOptions.class.cast(super.wrapInInitScript(wrapInInitScript)); }
@Override public TemplateOptions wrapInInitScript(boolean wrapInInitScript) { return TemplateOptions.class.cast(super.wrapInInitScript(wrapInInitScript)); }
@Override public TemplateOptions wrapInInitScript(boolean wrapInInitScript) { return TemplateOptions.class.cast(super.wrapInInitScript(wrapInInitScript)); }
@Override public TemplateOptions wrapInInitScript(boolean wrapInInitScript) { return TemplateOptions.class.cast(super.wrapInInitScript(wrapInInitScript)); }
public static RunScriptOptions recipeScriptOptions(RunScriptOptions options) { return options.wrapInInitScript(true).runAsRoot(true); }
public static RunScriptOptions wrapInInitScript(boolean value) { RunScriptOptions options = new RunScriptOptions(); return options.wrapInInitScript(value); }
public static RunScriptOptions wrapInInitScript(boolean value) { RunScriptOptions options = new RunScriptOptions(); return options.wrapInInitScript(value); }
public static RunScriptOptions wrapInInitScript(boolean value) { RunScriptOptions options = new RunScriptOptions(); return options.wrapInInitScript(value); }
public static RunScriptOptions wrapInInitScript(boolean value) { RunScriptOptions options = new RunScriptOptions(); return options.wrapInInitScript(value); }
public static RunScriptOptions recipeScriptOptions(RunScriptOptions options) { return options.wrapInInitScript(true).runAsRoot(true); }
/** * Execute a command on a group of nodes * @param group name of the group * @param command the command to be executed * @param login username * @param key sshkey * @throws RunScriptOnNodesException */ public void execCommandInGroup(String group, String command, String login, String key) throws RunScriptOnNodesException{ journal.log(Level.INFO, ">> executing command..."); journal.log(Level.INFO, ">> "+ command); try { String contentKey=FileUtils.readFileToString(new File(key)); Map<? extends NodeMetadata, ExecResponse> responses = compute.runScriptOnNodesMatching( runningInGroup(group), exec(command), overrideLoginCredentials(new LoginCredentials(login, null, contentKey, false)) .runAsRoot(false) .wrapInInitScript(false));// run command directly for(Entry<? extends NodeMetadata, ExecResponse> r : responses.entrySet()) journal.log(Level.INFO, ">> "+r.getValue()); } catch (IOException e) { journal.log(Level.SEVERE, ">> Unable to find key file - check your path!"); } }
/** * Execute a command on a specified node * @param id id of the node * @param command the command to be executed * @param login username * @param keyPath sshkey for connection */ public void execCommand(String id, String command, String login, String key){ journal.log(Level.INFO, ">> executing command..."); journal.log(Level.INFO, ">> "+ command); try { String contentKey=FileUtils.readFileToString(new File(key)); ExecResponse response = compute.runScriptOnNode( id, exec(command), overrideLoginCredentials(new LoginCredentials(login, null, contentKey, false)) .runAsRoot(false) .wrapInInitScript(false));// run command directly journal.log(Level.INFO, ">> "+response.getOutput()); } catch (IOException e) { journal.log(Level.SEVERE, ">> Unable to find key file - check your path!"); } }
public Map<? extends NodeMetadata, ExecResponse> runScriptOnNodesMatching(final ClusterSpec spec, Predicate<NodeMetadata> condition, final Statement statement) throws IOException, RunScriptOnNodesException { ComputeServiceContext computeServiceContext = getCompute().apply(spec); ComputeService computeService = computeServiceContext.getComputeService(); Cluster cluster = getClusterStateStore(spec).load(); RunScriptOptions options = RunScriptOptions.Builder.runAsRoot(false).wrapInInitScript(false); return computeService.runScriptOnNodesMatching(Predicates.<NodeMetadata>and(condition, runningIn(cluster)), statement, options); }
/** * Execute a command on a group of VMs * @param group name of the group * @param command the command to be executed * @param login username * @param key sshkey * @throws RunScriptOnNodesException */ public void execCommandInGroup(String group, String command, String login, String key) throws RunScriptOnNodesException { journal.log(Level.INFO, ">> executing command..."); journal.log(Level.INFO, ">> "+ command); org.jclouds.domain.LoginCredentials.Builder b=initCredentials(login, key); Map<? extends NodeMetadata, ExecResponse> responses = novaComputeService.runScriptOnNodesMatching( runningInGroup(group), exec(command), overrideLoginCredentials(b.build()) .runAsRoot(false) .wrapInInitScript(false));// run command directly for(Map.Entry<? extends NodeMetadata, ExecResponse> r : responses.entrySet()) journal.log(Level.INFO, ">> "+r.getValue()); }
public Map<? extends NodeMetadata, ExecResponse> runScriptOnNodesMatching(final ClusterSpec spec, Predicate<NodeMetadata> condition, final Statement statement) throws IOException, RunScriptOnNodesException { ComputeServiceContext computeServiceContext = getCompute().apply(spec); ComputeService computeService = computeServiceContext.getComputeService(); Cluster cluster = getClusterStateStore(spec).load(); RunScriptOptions options = RunScriptOptions.Builder.runAsRoot(false).wrapInInitScript(false); return computeService.runScriptOnNodesMatching(Predicates.<NodeMetadata>and(condition, runningIn(cluster)), statement, options); }
public RunScriptOptions defaultRunScriptOptionsForSpec(ClusterSpec spec) { LoginCredentials credentials = LoginCredentials.builder() .user(spec.getClusterUser()).privateKey(spec.getPrivateKey()).build(); return overrideLoginCredentials(credentials).wrapInInitScript(false) .runAsRoot(false); }
public RunScriptOptions defaultRunScriptOptionsForSpec(ClusterSpec spec) { LoginCredentials credentials = LoginCredentials.builder() .user(spec.getClusterUser()).privateKey(spec.getPrivateKey()).build(); return overrideLoginCredentials(credentials).wrapInInitScript(false) .runAsRoot(false); }
/** * Run set of queued commands now */ public static void executeOnNodes(List<Statement> commands, boolean runAsRoot, String clustername, ComputeService compute, String username, String sshKeyName) throws RunScriptOnNodesException, InterruptedException, ExecutionException, TimeoutException { compute.runScriptOnNodesMatching( NodePredicates.runningInGroup(clustername), new StatementList(commands), new RunScriptOptions() .nameTask("Setup") .overrideLoginCredentials(Tools.getPrivateKeyCredentials(username, sshKeyName)) .wrapInInitScript(true) .overrideLoginUser(username) .blockOnComplete(true) .runAsRoot(runAsRoot)); }
public void copyTo(RunScriptOptions to) { if (this.getPort() != -1) to.blockOnPort(this.getPort(), this.getSeconds()); if (this.getTaskName() != null) to.nameTask(this.getTaskName()); to.runAsRoot(this.shouldRunAsRoot()); to.blockOnComplete(this.shouldBlockOnComplete()); to.wrapInInitScript(this.shouldWrapInInitScript()); if (this.hasLoginPasswordOption()) to.overrideLoginPassword(this.loginPassword); if (this.hasLoginPrivateKeyOption()) to.overrideLoginPrivateKey(this.loginPrivateKey); if (this.getLoginUser() != null) to.overrideLoginUser(this.getLoginUser()); if (this.shouldAuthenticateSudo() != null) { to.overrideAuthenticateSudo(this.shouldAuthenticateSudo()); } }
public void copyTo(RunScriptOptions to) { if (this.getPort() != -1) to.blockOnPort(this.getPort(), this.getSeconds()); if (this.getTaskName() != null) to.nameTask(this.getTaskName()); to.runAsRoot(this.shouldRunAsRoot()); to.blockOnComplete(this.shouldBlockOnComplete()); to.wrapInInitScript(this.shouldWrapInInitScript()); if (this.hasLoginPasswordOption()) to.overrideLoginPassword(this.loginPassword); if (this.hasLoginPrivateKeyOption()) to.overrideLoginPrivateKey(this.loginPrivateKey); if (this.getLoginUser() != null) to.overrideLoginUser(this.getLoginUser()); if (this.shouldAuthenticateSudo() != null) { to.overrideAuthenticateSudo(this.shouldAuthenticateSudo()); } }