Package org.jclouds.compute.options
Class RunScriptOptions
- java.lang.Object
-
- org.jclouds.compute.options.RunScriptOptions
-
- Direct Known Subclasses:
RunScriptOptions.ImmutableRunScriptOptions
,TemplateOptions
public class RunScriptOptions extends Object
Enables additional options for running a script.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RunScriptOptions.Builder
static class
RunScriptOptions.ImmutableRunScriptOptions
-
Field Summary
Fields Modifier and Type Field Description protected Boolean
authenticateSudo
protected boolean
blockOnComplete
protected com.google.common.base.Optional<String>
loginPassword
protected com.google.common.base.Optional<String>
loginPrivateKey
protected String
loginUser
static RunScriptOptions
NONE
Default options.protected int
port
protected boolean
runAsRoot
protected int
seconds
protected String
taskName
protected boolean
wrapInInitScript
-
Constructor Summary
Constructors Constructor Description RunScriptOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RunScriptOptions
blockOnComplete(boolean blockOnComplete)
As of version 1.1.0, we cannot kick off a script unless a node is in RUNNING state.RunScriptOptions
blockOnPort(int port, int seconds)
When the node is started, wait until the following port is activevoid
copyTo(RunScriptOptions to)
boolean
equals(Object o)
String
getLoginPassword()
String
getLoginPrivateKey()
String
getLoginUser()
int
getPort()
int
getSeconds()
String
getTaskName()
int
hashCode()
boolean
hasLoginPassword()
boolean
hasLoginPasswordOption()
boolean
hasLoginPrivateKey()
boolean
hasLoginPrivateKeyOption()
RunScriptOptions
nameTask(String name)
RunScriptOptions
overrideAuthenticateSudo(boolean authenticateSudo)
RunScriptOptions
overrideLoginCredentials(LoginCredentials overridingCredentials)
RunScriptOptions
overrideLoginPassword(com.google.common.base.Optional<String> password)
RunScriptOptions
overrideLoginPassword(String password)
RunScriptOptions
overrideLoginPrivateKey(com.google.common.base.Optional<String> privateKey)
RunScriptOptions
overrideLoginPrivateKey(String privateKey)
RunScriptOptions
overrideLoginUser(String loginUser)
RunScriptOptions
runAsRoot(boolean runAsRoot)
Boolean
shouldAuthenticateSudo()
boolean
shouldBlockOnComplete()
boolean
shouldRunAsRoot()
Whether to run the script as root (or run with current privileges).boolean
shouldWrapInInitScript()
Whether to wait until the script has completed.protected com.google.common.base.MoreObjects.ToStringHelper
string()
String
toString()
RunScriptOptions
wrapInInitScript(boolean wrapInInitScript)
default true
-
-
-
Field Detail
-
NONE
public static final RunScriptOptions NONE
Default options. The default settings are:- override the credentials with ones supplied in call to
ComputeService.runScriptOnNodesMatching(com.google.common.base.Predicate<? super org.jclouds.compute.domain.NodeMetadata>, java.lang.String)
- run the script as root (versus running with current privileges)
- override the credentials with ones supplied in call to
-
port
protected int port
-
seconds
protected int seconds
-
taskName
protected String taskName
-
runAsRoot
protected boolean runAsRoot
-
blockOnComplete
protected boolean blockOnComplete
-
wrapInInitScript
protected boolean wrapInInitScript
-
loginUser
protected String loginUser
-
authenticateSudo
protected Boolean authenticateSudo
-
loginPassword
protected com.google.common.base.Optional<String> loginPassword
-
loginPrivateKey
protected com.google.common.base.Optional<String> loginPrivateKey
-
-
Method Detail
-
copyTo
public void copyTo(RunScriptOptions to)
-
overrideLoginCredentials
public RunScriptOptions overrideLoginCredentials(LoginCredentials overridingCredentials)
-
overrideLoginUser
public RunScriptOptions overrideLoginUser(String loginUser)
-
overrideLoginPassword
public RunScriptOptions overrideLoginPassword(String password)
-
overrideLoginPrivateKey
public RunScriptOptions overrideLoginPrivateKey(String privateKey)
-
overrideLoginPassword
public RunScriptOptions overrideLoginPassword(com.google.common.base.Optional<String> password)
-
overrideLoginPrivateKey
public RunScriptOptions overrideLoginPrivateKey(com.google.common.base.Optional<String> privateKey)
-
overrideAuthenticateSudo
public RunScriptOptions overrideAuthenticateSudo(boolean authenticateSudo)
-
nameTask
public RunScriptOptions nameTask(String name)
- Returns:
- What to call the task relating to this script; default
jclouds-script-timestamp
where timestamp is millis since epoch
-
runAsRoot
public RunScriptOptions runAsRoot(boolean runAsRoot)
-
wrapInInitScript
public RunScriptOptions wrapInInitScript(boolean wrapInInitScript)
default true- Parameters:
wrapInInitScript
- if the command is long-running, use this option to ensure it is wrapInInitScripted properly. (ex. have jclouds wrap it an init script, nohup, etc)- Returns:
-
blockOnComplete
public RunScriptOptions blockOnComplete(boolean blockOnComplete)
As of version 1.1.0, we cannot kick off a script unless a node is in RUNNING state.- Parameters:
blockOnComplete
- (default true) false means kick off the script in the background, but don't wait for it to finish. (as of version 1.1.0, implemented as nohup)
-
blockOnPort
public RunScriptOptions blockOnPort(int port, int seconds)
When the node is started, wait until the following port is active
-
getTaskName
public String getTaskName()
-
getPort
public int getPort()
-
getSeconds
public int getSeconds()
-
getLoginUser
@Nullable public String getLoginUser()
- Returns:
- the login user for
ComputeService.runScriptOnNode(java.lang.String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions)
. By default, null.
-
shouldAuthenticateSudo
@Nullable public Boolean shouldAuthenticateSudo()
- Returns:
- Whether the login user should authenticate sudo during
ComputeService.runScriptOnNode(java.lang.String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions)
. By default, null.
-
hasLoginPasswordOption
public boolean hasLoginPasswordOption()
- Returns:
- true if the login password has been configured
-
hasLoginPassword
public boolean hasLoginPassword()
- Returns:
- true if the login password is set
-
getLoginPassword
@Nullable public String getLoginPassword()
- Returns:
- the login password for
ComputeService.runScriptOnNode(java.lang.String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions)
. By default, null.
-
hasLoginPrivateKeyOption
public boolean hasLoginPrivateKeyOption()
- Returns:
- true if the login ssh key has been configured
-
hasLoginPrivateKey
public boolean hasLoginPrivateKey()
- Returns:
- true if the login ssh key is set
-
getLoginPrivateKey
@Nullable public String getLoginPrivateKey()
- Returns:
- the login ssh key for
ComputeService.runScriptOnNode(java.lang.String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions)
. By default, null.
-
shouldRunAsRoot
public boolean shouldRunAsRoot()
Whether to run the script as root (or run with current privileges). By default, true.- Returns:
- value
-
shouldBlockOnComplete
public boolean shouldBlockOnComplete()
- See Also:
blockOnComplete(boolean)
-
shouldWrapInInitScript
public boolean shouldWrapInInitScript()
Whether to wait until the script has completed. By default, true.- Returns:
- value
-
string
protected com.google.common.base.MoreObjects.ToStringHelper string()
-
-