Package org.jclouds.compute.callables
Class RunScriptOnNodeUsingSsh
- java.lang.Object
-
- org.jclouds.compute.callables.RunScriptOnNodeUsingSsh
-
- All Implemented Interfaces:
Callable<ExecResponse>,RunScriptOnNode
public class RunScriptOnNodeUsingSsh extends Object implements RunScriptOnNode
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jclouds.compute.callables.RunScriptOnNode
RunScriptOnNode.Factory
-
-
Field Summary
Fields Modifier and Type Field Description protected com.google.common.eventbus.EventBuseventBusprotected Loggerloggerstatic StringMARKERprotected NodeMetadatanodeprotected booleanrunAsRootprotected SshClientsshprotected com.google.common.base.Function<NodeMetadata,SshClient>sshFactoryprotected Statementstatement
-
Constructor Summary
Constructors Constructor Description RunScriptOnNodeUsingSsh(com.google.common.base.Function<NodeMetadata,SshClient> sshFactory, com.google.common.eventbus.EventBus eventBus, NodeMetadata node, Statement statement, RunScriptOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExecResponsecall()Note thatRunScriptOnNode.init()must be called first.StringexecAsRoot(String command)protected StringexecScriptAsDefaultUser(String command)NodeMetadatagetNode()the node this command is being executed on.StatementgetStatement()RunScriptOnNodeinit()verifies that the command can execute on the node.protected ExecResponserunCommand(String command)StringtoString()
-
-
-
Field Detail
-
MARKER
public static final String MARKER
- See Also:
- Constant Field Values
-
logger
@Named("jclouds.compute") protected Logger logger
-
sshFactory
protected final com.google.common.base.Function<NodeMetadata,SshClient> sshFactory
-
eventBus
protected final com.google.common.eventbus.EventBus eventBus
-
node
protected final NodeMetadata node
-
statement
protected final Statement statement
-
runAsRoot
protected final boolean runAsRoot
-
ssh
protected SshClient ssh
-
-
Constructor Detail
-
RunScriptOnNodeUsingSsh
public RunScriptOnNodeUsingSsh(com.google.common.base.Function<NodeMetadata,SshClient> sshFactory, com.google.common.eventbus.EventBus eventBus, NodeMetadata node, Statement statement, RunScriptOptions options)
-
-
Method Detail
-
call
public ExecResponse call()
Description copied from interface:RunScriptOnNodeNote thatRunScriptOnNode.init()must be called first.- Specified by:
callin interfaceCallable<ExecResponse>- Specified by:
callin interfaceRunScriptOnNode
-
init
public RunScriptOnNode init()
Description copied from interface:RunScriptOnNodeverifies that the command can execute on the node. For example, if this is ssh, it may attempt to find a reachable socket. If this is using an API, it may attempt to validate that connection.- Specified by:
initin interfaceRunScriptOnNode
-
runCommand
protected ExecResponse runCommand(String command)
-
getNode
public NodeMetadata getNode()
Description copied from interface:RunScriptOnNodethe node this command is being executed on.- Specified by:
getNodein interfaceRunScriptOnNode
-
getStatement
public Statement getStatement()
- Specified by:
getStatementin interfaceRunScriptOnNode- Returns:
- statement that will be executed
-
-