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.Logger
logger
static java.lang.String
MESSAGE_ERROR_FILE_BUSY_PATTERN
static java.lang.String
NODE_ATTR_ENABLE_SYNC_COMMAND
static java.lang.String
NODE_ATTR_FILE_BUSY_ERR_RETRY
static java.lang.String
SCRIPT_FILE_REMOVE_TMP
-
Constructor Summary
Constructors Constructor Description DefaultScriptFileNodeStepUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NodeStepResult
executeRemoteScript(ExecutionContext context, Framework framework, INodeEntry node, java.lang.String[] args, java.lang.String filepath)
Execute a scriptfile already copied to a remote node with the given argsNodeStepResult
executeRemoteScript(ExecutionContext context, Framework 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 argsNodeStepResult
executeRemoteScript(ExecutionContext context, Framework 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 argsNodeStepResult
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)
Execute a script on a remote nodeFileCopierUtil
getFileCopierUtil()
ExecArgList
removeArgsForOsFamily(java.lang.String filepath, java.lang.String osFamily)
Return ExecArgList for removing a file for the given OS familyvoid
setFileCopierUtil(FileCopierUtil fileCopierUtil)
java.io.File
writeScriptToTempFile(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.
-
-
-
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:
executeScriptFile
in 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
-
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:
writeScriptToTempFile
in interfaceScriptFileNodeStepUtils
- Parameters:
context
- contextnode
- nodescriptString
- stringserverScriptFilePath
- filescriptAsStream
- stream- Returns:
- temp file
- Throws:
FileCopierException
- on error
-
executeRemoteScript
public NodeStepResult executeRemoteScript(ExecutionContext context, Framework 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:
executeRemoteScript
in 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, Framework 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:
executeRemoteScript
in 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, Framework 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:
executeRemoteScript
in 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
-
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:
removeArgsForOsFamily
in interfaceScriptFileNodeStepUtils
- Parameters:
filepath
- pathosFamily
- family- Returns:
- arg list
-
getFileCopierUtil
public FileCopierUtil getFileCopierUtil()
-
setFileCopierUtil
public void setFileCopierUtil(FileCopierUtil fileCopierUtil)
-
-