/** * @see #runScriptOnNode(String, String, org.jclouds.compute.options.RunScriptOptions) */ @Override public ExecResponse runScriptOnNode(String id, String runScript) { return computeService.runScriptOnNode(id, runScript); }
/** * @see #runScriptOnNode(String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions) * @see org.jclouds.scriptbuilder.domain.Statements#exec */ @Override public ExecResponse runScriptOnNode(String id, String runScript, RunScriptOptions options) { return computeService.runScriptOnNode(id, runScript, options); }
/** * @see #runScriptOnNode(String, String, org.jclouds.compute.options.RunScriptOptions) */ @Override public ExecResponse runScriptOnNode(String id, String runScript) { return computeService.runScriptOnNode(id, runScript); }
/** * @see #runScriptOnNode(String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions) */ @Override public ExecResponse runScriptOnNode(String id, Statement runScript) { return computeService.runScriptOnNode(id, runScript); }
/** * @see #runScriptOnNode(String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions) * @see org.jclouds.scriptbuilder.domain.Statements#exec */ @Override public ExecResponse runScriptOnNode(String id, String runScript, RunScriptOptions options) { return computeService.runScriptOnNode(id, runScript, options); }
/** * @see #runScriptOnNode(String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions) */ @Override public ExecResponse runScriptOnNode(String id, Statement runScript) { return computeService.runScriptOnNode(id, runScript); }
/** * Run the script on a specific node * * @param id node the script is to be executed on * @param runScript statement containing the script to run * @param options nullable options to how to run the script, whether to override credentials * @return map with node identifiers and corresponding responses * @throws java.util.NoSuchElementException * if the node is not found * @throws IllegalStateException if the node is not in running state * @throws org.jclouds.compute.callables.ScriptStillRunningException * if the script was still running after {@link org.jclouds.compute.reference.ComputeServiceConstants.Timeouts#scriptComplete} * @see org.jclouds.compute.predicates.NodePredicates#runningInGroup(String) * @see org.jclouds.scriptbuilder.domain.Statements */ @Override public ExecResponse runScriptOnNode(String id, Statement runScript, RunScriptOptions options) { return computeService.runScriptOnNode(id, runScript, options); }
@Override public ExecResponse runScriptOnNode(String id, Statement runScript) { return delegate.runScriptOnNode(id, runScript); }
@Override public ExecResponse runScriptOnNode(String id, String runScript, RunScriptOptions options) { return delegate.runScriptOnNode(id, runScript, options); }
@Override public ExecResponse runScriptOnNode(String id, String runScript) { return delegate.runScriptOnNode(id, runScript); }
@Override public ExecResponse runScriptOnNode(String id, Statement runScript, RunScriptOptions options) { return delegate.runScriptOnNode(id, runScript, options); }
public ExecResponse startDaemonOnNode(InitScript daemon, String nodeId) { return compute.runScriptOnNode(nodeId, daemon, asCurrentUser().blockOnComplete(false)); }
private void mapSecurityGroupRuleToIpTables(ComputeService computeService, NodeMetadata node, LoginCredentials credentials, String networkInterface, Iterable<Integer> ports) { for (Integer port : ports) { String insertIptableRule = IptablesCommands.insertIptablesRule(Chain.INPUT, networkInterface, Protocol.TCP, port, Policy.ACCEPT); Statement statement = Statements.newStatementList(exec(insertIptableRule)); ExecResponse response = computeService.runScriptOnNode(node.getId(), statement, overrideLoginCredentials(credentials).runAsRoot(false)); if (response.getExitStatus() != 0) { String msg = String.format("Cannot insert the iptables rule for port %d. Error: %s", port, response.getError()); LOG.error(msg); throw new RuntimeException(msg); } } }
protected String exec(final String nodeId, Statement command) { return client.runScriptOnNode(nodeId, command, runAsRoot(false).wrapInInitScript(false)).getOutput().trim(); }
public Boolean call() { Statement statement = Statements.newStatementList(exec("hostname")); // NB this assumes passwordless sudo ! ExecResponse response = computeService.runScriptOnNode(nodeRef.getId(), statement, overrideLoginCredentials(expectedCredentialsRef).runAsRoot(false)); return response.getExitStatus() == 0; }}) .limitTimeTo(delayMs, MILLISECONDS)
protected String exec(final String nodeId, Statement command) { return client.runScriptOnNode(nodeId, command, runAsRoot(false).wrapInInitScript(false)).getOutput().trim(); }
protected String exec(final String nodeId, Statement command) { return client.runScriptOnNode(nodeId, command, runAsRoot(false).wrapInInitScript(false)).getOutput().trim(); }
protected ServiceStats trackAvailabilityOfProcessOnNode(Statement process, String processName, NodeMetadata node) { ServiceStats stats = new ServiceStats(); Stopwatch watch = Stopwatch.createStarted(); ExecResponse exec = client.runScriptOnNode(node.getId(), process, runAsRoot(false).wrapInInitScript(false)); stats.backgroundProcessMilliseconds = watch.elapsed(TimeUnit.MILLISECONDS); watch.reset().start(); HostAndPort socket = null; try { socket = openSocketFinder.findOpenSocketOnNode(node, 8080, 600, TimeUnit.SECONDS); } catch (NoSuchElementException e) { throw new NoSuchElementException(format("%s%n%s%s", e.getMessage(), exec.getOutput(), exec.getError())); } stats.socketOpenMilliseconds = watch.elapsed(TimeUnit.MILLISECONDS); getAnonymousLogger().info(format("<< %s on node(%s)[%s] %s", processName, node.getId(), socket, stats)); return stats; }
@Override protected void prepareNodeBeforeCreatingImage(NodeMetadata node) { // Don't wrap in the init-script, since the comand will clear the user // config, and jclouds won't be able to execute more than one command // (won't be able to poll for the execution status of the command when // running with the init-script) ExecResponse result = view.getComputeService().runScriptOnNode(node.getId(), "waagent -deprovision+user -force", wrapInInitScript(false)); assertEquals(result.getExitStatus(), 0); }
protected ServiceStats trackAvailabilityOfProcessOnNode(Statement process, String processName, NodeMetadata node) { ServiceStats stats = new ServiceStats(); Stopwatch watch = new Stopwatch().start(); ExecResponse exec = client.runScriptOnNode(node.getId(), process, runAsRoot(false).wrapInInitScript(false)); stats.backgroundProcessMilliseconds = watch.elapsedTime(TimeUnit.MILLISECONDS); watch.reset().start(); HostAndPort socket = null; try { socket = openSocketFinder.findOpenSocketOnNode(node, 8080, 60, TimeUnit.SECONDS); } catch (NoSuchElementException e) { throw new NoSuchElementException(format("%s%n%s%s", e.getMessage(), exec.getOutput(), exec.getError())); } stats.socketOpenMilliseconds = watch.elapsedTime(TimeUnit.MILLISECONDS); getAnonymousLogger().info(format("<< %s on node(%s)[%s] %s", processName, node.getId(), socket, stats)); return stats; }