Class DefaultScriptFileNodeStepUtils

    • 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
    • Constructor Detail

      • DefaultScriptFileNodeStepUtils

        public DefaultScriptFileNodeStepUtils()
    • 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 interface ScriptFileNodeStepUtils
        Parameters:
        context - context
        node - node
        scriptString - string
        serverScriptFilePath - file
        scriptAsStream - stream
        fileExtension - file extension
        args - script args
        scriptInterpreter - invoker string
        quoted - true if args are quoted
        executionService - 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 interface ScriptFileNodeStepUtils
        Parameters:
        context - context
        node - node
        scriptString - string
        serverScriptFilePath - file
        scriptAsStream - 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,
                                                  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 interface ScriptFileNodeStepUtils
        Parameters:
        context - context
        framework - framework
        node - the node
        args - arguments to script
        filepath - the remote path for the script
        scriptInterpreter - interpreter used to invoke the script
        interpreterargsquoted - 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 interface ScriptFileNodeStepUtils
        Parameters:
        context - context
        framework - framework
        node - the node
        args - arguments to script
        filepath - the remote path for the script
        scriptInterpreter - interpreter used to invoke the script
        interpreterargsquoted - if true, pass the file and script args as a single argument to the interpreter
        removeFile - 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 interface ScriptFileNodeStepUtils
        Parameters:
        filepath - path
        osFamily - family
        Returns:
        arg list
      • setFileCopierUtil

        public void setFileCopierUtil​(FileCopierUtil fileCopierUtil)