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.EventBus
eventBus
protected Logger
logger
static String
MARKER
protected NodeMetadata
node
protected boolean
runAsRoot
protected SshClient
ssh
protected com.google.common.base.Function<NodeMetadata,SshClient>
sshFactory
protected Statement
statement
-
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 ExecResponse
call()
Note thatRunScriptOnNode.init()
must be called first.String
execAsRoot(String command)
protected String
execScriptAsDefaultUser(String command)
NodeMetadata
getNode()
the node this command is being executed on.Statement
getStatement()
RunScriptOnNode
init()
verifies that the command can execute on the node.protected ExecResponse
runCommand(String command)
String
toString()
-
-
-
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:RunScriptOnNode
Note thatRunScriptOnNode.init()
must be called first.- Specified by:
call
in interfaceCallable<ExecResponse>
- Specified by:
call
in interfaceRunScriptOnNode
-
init
public RunScriptOnNode init()
Description copied from interface:RunScriptOnNode
verifies 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:
init
in interfaceRunScriptOnNode
-
runCommand
protected ExecResponse runCommand(String command)
-
getNode
public NodeMetadata getNode()
Description copied from interface:RunScriptOnNode
the node this command is being executed on.- Specified by:
getNode
in interfaceRunScriptOnNode
-
getStatement
public Statement getStatement()
- Specified by:
getStatement
in interfaceRunScriptOnNode
- Returns:
- statement that will be executed
-
-