Class DefaultScriptFileNodeStepUtils
- java.lang.Object
-
- com.dtolabs.rundeck.core.execution.workflow.steps.node.impl.DefaultScriptFileNodeStepUtils
-
- All Implemented Interfaces:
ScriptFileNodeStepUtils
public class DefaultScriptFileNodeStepUtils extends java.lang.Object implements ScriptFileNodeStepUtils
Created by greg on 7/15/16.
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Loggerloggerstatic java.lang.StringMESSAGE_ERROR_FILE_BUSY_PATTERNstatic java.lang.StringNODE_ATTR_ENABLE_SYNC_COMMANDstatic java.lang.StringNODE_ATTR_FILE_BUSY_ERR_RETRYstatic java.lang.StringSCRIPT_FILE_REMOVE_TMP
-
Constructor Summary
Constructors Constructor Description DefaultScriptFileNodeStepUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NodeStepResultexecuteRemoteScript(ExecutionContext context, IFramework framework, INodeEntry node, java.lang.String[] args, java.lang.String filepath)Execute a scriptfile already copied to a remote node with the given argsNodeStepResultexecuteRemoteScript(ExecutionContext context, IFramework framework, INodeEntry node, java.lang.String[] args, java.lang.String filepath, java.lang.String scriptInterpreter, boolean interpreterargsquoted)Execute a scriptfile already copied to a remote node with the given argsNodeStepResultexecuteRemoteScript(ExecutionContext context, IFramework framework, INodeEntry node, java.lang.String[] args, java.lang.String filepath, java.lang.String scriptInterpreter, boolean interpreterargsquoted, boolean removeFile)Execute a scriptfile already copied to a remote node with the given argsNodeStepResultexecuteRemoteScript(ExecutionContext context, IFramework framework, INodeEntry node, java.lang.String[] args, java.lang.String filepath, java.lang.String scriptInterpreter, boolean interpreterargsquoted, boolean removeFile, java.io.InputStream input)Execute a scriptfile already copied to a remote node with the given argsNodeStepResultexecuteRemoteScript(ExecutionContext context, IFramework framework, INodeEntry node, java.lang.String[] args, java.lang.String filepath, java.lang.String scriptInterpreter, boolean interpreterargsquoted, java.io.InputStream inputStream)Execute a scriptfile already copied to a remote node with the given argsNodeStepResultexecuteScriptFile(StepExecutionContext context, INodeEntry node, java.lang.String scriptString, java.lang.String serverScriptFilePath, java.io.InputStream scriptAsStream, java.lang.String fileExtension, java.lang.String[] args, java.lang.String scriptInterpreter, boolean quoted, NodeExecutionService executionService, boolean expandTokens)Execute a script on a remote nodeNodeStepResultexecuteScriptFile(StepExecutionContext context, INodeEntry node, java.lang.String scriptString, java.lang.String serverScriptFilePath, java.io.InputStream scriptAsStream, java.lang.String fileExtension, java.lang.String[] args, java.lang.String scriptInterpreter, java.io.InputStream input, boolean quoted, NodeExecutionService executionService, boolean expandTokens, FileCopierUtil.ContentModifier modifier)Execute a script on a remote nodeFileCopierUtilgetFileCopierUtil()ExecArgListremoveArgsForOsFamily(java.lang.String filepath, java.lang.String osFamily)Return ExecArgList for removing a file for the given OS familyvoidsetFileCopierUtil(FileCopierUtil fileCopierUtil)java.io.FilewriteScriptToTempFile(StepExecutionContext context, INodeEntry node, java.lang.String scriptString, java.lang.String serverScriptFilePath, java.io.InputStream scriptAsStream, boolean expandTokens)Copy the script input to a temp file and expand embedded tokens, if it is a string or inputstream.java.io.FilewriteScriptToTempFile(StepExecutionContext context, INodeEntry node, java.lang.String scriptString, java.lang.String serverScriptFilePath, java.io.InputStream scriptAsStream, boolean expandTokens, FileCopierUtil.ContentModifier scriptModifierUtil)Copy the script input to a temp file and expand embedded tokens, if it is a string or inputstream.
-
-
-
Field Detail
-
logger
public static final org.slf4j.Logger logger
-
SCRIPT_FILE_REMOVE_TMP
public static final java.lang.String SCRIPT_FILE_REMOVE_TMP
- See Also:
- Constant Field Values
-
MESSAGE_ERROR_FILE_BUSY_PATTERN
public static final java.lang.String MESSAGE_ERROR_FILE_BUSY_PATTERN
- See Also:
- Constant Field Values
-
NODE_ATTR_FILE_BUSY_ERR_RETRY
public static final java.lang.String NODE_ATTR_FILE_BUSY_ERR_RETRY
- See Also:
- Constant Field Values
-
NODE_ATTR_ENABLE_SYNC_COMMAND
public static final java.lang.String NODE_ATTR_ENABLE_SYNC_COMMAND
- See Also:
- Constant Field Values
-
-
Method Detail
-
executeScriptFile
public NodeStepResult executeScriptFile(StepExecutionContext context, INodeEntry node, java.lang.String scriptString, java.lang.String serverScriptFilePath, java.io.InputStream scriptAsStream, java.lang.String fileExtension, java.lang.String[] args, java.lang.String scriptInterpreter, boolean quoted, NodeExecutionService executionService, boolean expandTokens) throws NodeStepException
Execute a script on a remote node- Specified by:
executeScriptFilein interfaceScriptFileNodeStepUtils- Parameters:
context- contextnode- nodescriptString- stringserverScriptFilePath- filescriptAsStream- streamfileExtension- file extensionargs- script argsscriptInterpreter- invoker stringquoted- true if args are quotedexecutionService- service- Returns:
- execution result
- Throws:
NodeStepException- on error
-
executeScriptFile
public NodeStepResult executeScriptFile(StepExecutionContext context, INodeEntry node, java.lang.String scriptString, java.lang.String serverScriptFilePath, java.io.InputStream scriptAsStream, java.lang.String fileExtension, java.lang.String[] args, java.lang.String scriptInterpreter, java.io.InputStream input, boolean quoted, NodeExecutionService executionService, boolean expandTokens, FileCopierUtil.ContentModifier modifier) throws NodeStepException
Execute a script on a remote node- Specified by:
executeScriptFilein interfaceScriptFileNodeStepUtils- Parameters:
context- contextnode- nodescriptString- stringserverScriptFilePath- filescriptAsStream- streamfileExtension- file extensionargs- script argsscriptInterpreter- invoker stringquoted- true if args are quotedexecutionService- serviceinput- inputstream to send to the script- Returns:
- execution result
- Throws:
NodeStepException- on error
-
writeScriptToTempFile
public java.io.File writeScriptToTempFile(StepExecutionContext context, INodeEntry node, java.lang.String scriptString, java.lang.String serverScriptFilePath, java.io.InputStream scriptAsStream, boolean expandTokens) throws FileCopierException
Copy the script input to a temp file and expand embedded tokens, if it is a string or inputstream. If it is a local file, use the original without modification- Specified by:
writeScriptToTempFilein interfaceScriptFileNodeStepUtils- Parameters:
context- contextnode- nodescriptString- stringserverScriptFilePath- filescriptAsStream- stream- Returns:
- temp file
- Throws:
FileCopierException- on error
-
writeScriptToTempFile
public java.io.File writeScriptToTempFile(StepExecutionContext context, INodeEntry node, java.lang.String scriptString, java.lang.String serverScriptFilePath, java.io.InputStream scriptAsStream, boolean expandTokens, FileCopierUtil.ContentModifier scriptModifierUtil) throws FileCopierException
Copy the script input to a temp file and expand embedded tokens, if it is a string or inputstream. If it is a local file, use the original without modification- Specified by:
writeScriptToTempFilein interfaceScriptFileNodeStepUtils- Parameters:
context- contextnode- nodescriptString- stringserverScriptFilePath- filescriptAsStream- stream- Returns:
- temp file
- Throws:
FileCopierException- on error
-
executeRemoteScript
public NodeStepResult executeRemoteScript(ExecutionContext context, IFramework framework, INodeEntry node, java.lang.String[] args, java.lang.String filepath) throws NodeStepException
Execute a scriptfile already copied to a remote node with the given args- Specified by:
executeRemoteScriptin interfaceScriptFileNodeStepUtils- Parameters:
context- contextframework- frameworknode- the nodeargs- arguments to scriptfilepath- the remote path for the script- Returns:
- the result
- Throws:
NodeStepException- on error
-
executeRemoteScript
public NodeStepResult executeRemoteScript(ExecutionContext context, IFramework framework, INodeEntry node, java.lang.String[] args, java.lang.String filepath, java.lang.String scriptInterpreter, boolean interpreterargsquoted) throws NodeStepException
Execute a scriptfile already copied to a remote node with the given args- Specified by:
executeRemoteScriptin interfaceScriptFileNodeStepUtils- Parameters:
context- contextframework- frameworknode- the nodeargs- arguments to scriptfilepath- the remote path for the scriptscriptInterpreter- interpreter used to invoke the scriptinterpreterargsquoted- if true, pass the file and script args as a single argument to the interpreter- Returns:
- result
- Throws:
NodeStepException- on error
-
executeRemoteScript
public NodeStepResult executeRemoteScript(ExecutionContext context, IFramework framework, INodeEntry node, java.lang.String[] args, java.lang.String filepath, java.lang.String scriptInterpreter, boolean interpreterargsquoted, java.io.InputStream inputStream) throws NodeStepException
Execute a scriptfile already copied to a remote node with the given args- Specified by:
executeRemoteScriptin interfaceScriptFileNodeStepUtils- Parameters:
context- contextframework- frameworknode- the nodeargs- arguments to scriptfilepath- the remote path for the scriptscriptInterpreter- interpreter used to invoke the scriptinterpreterargsquoted- if true, pass the file and script args as a single argument to the interpreterinputStream- input to send to the script- Returns:
- result
- Throws:
NodeStepException- on error
-
executeRemoteScript
public NodeStepResult executeRemoteScript(ExecutionContext context, IFramework framework, INodeEntry node, java.lang.String[] args, java.lang.String filepath, java.lang.String scriptInterpreter, boolean interpreterargsquoted, boolean removeFile) throws NodeStepException
Execute a scriptfile already copied to a remote node with the given args- Specified by:
executeRemoteScriptin interfaceScriptFileNodeStepUtils- Parameters:
context- contextframework- frameworknode- the nodeargs- arguments to scriptfilepath- the remote path for the scriptscriptInterpreter- interpreter used to invoke the scriptinterpreterargsquoted- if true, pass the file and script args as a single argument to the interpreterremoveFile- if true, remove the file after execution- Returns:
- result
- Throws:
NodeStepException- on error
-
executeRemoteScript
public NodeStepResult executeRemoteScript(ExecutionContext context, IFramework framework, INodeEntry node, java.lang.String[] args, java.lang.String filepath, java.lang.String scriptInterpreter, boolean interpreterargsquoted, boolean removeFile, java.io.InputStream input)
Execute a scriptfile already copied to a remote node with the given args- Specified by:
executeRemoteScriptin interfaceScriptFileNodeStepUtils- Parameters:
context- contextframework- frameworknode- the nodeargs- arguments to scriptfilepath- the remote path for the scriptscriptInterpreter- interpreter used to invoke the scriptinterpreterargsquoted- if true, pass the file and script args as a single argument to the interpreterremoveFile- if true, remove the file after executioninput- input to send to the script- Returns:
- result
-
removeArgsForOsFamily
public ExecArgList removeArgsForOsFamily(java.lang.String filepath, java.lang.String osFamily)
Return ExecArgList for removing a file for the given OS family- Specified by:
removeArgsForOsFamilyin interfaceScriptFileNodeStepUtils- Parameters:
filepath- pathosFamily- family- Returns:
- arg list
-
getFileCopierUtil
public FileCopierUtil getFileCopierUtil()
-
setFileCopierUtil
public void setFileCopierUtil(FileCopierUtil fileCopierUtil)
-
-