Class LocalCommandExecutor
java.lang.Object
com.scivicslab.actoriac.mixin.LocalCommandExecutor
- All Implemented Interfaces:
CommandExecutor
Command executor that executes commands on the local machine.
Used by NodeGroupInterpreter to execute commands locally when running on the control node itself.
- Since:
- 2.15.0
- Author:
- devteam@scivicslab.com
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExecutes a command and returns the result.execute(String command, Node.OutputCallback callback) Executes a command and returns the result with output callback.executeSudo(String command) Executes a command with sudo privileges.executeSudo(String command, Node.OutputCallback callback) Executes a command with sudo privileges and output callback.Gets a short identifier for this executor (e.g., hostname).
-
Field Details
-
DEFAULT_TIMEOUT_SECONDS
- See Also:
-
hostname
-
-
Constructor Details
-
LocalCommandExecutor
public LocalCommandExecutor()Constructs a local command executor.
-
-
Method Details
-
execute
Description copied from interface:CommandExecutorExecutes a command and returns the result.- Specified by:
executein interfaceCommandExecutor- Parameters:
command- the command to execute- Returns:
- the result of command execution
- Throws:
IOException- if command execution fails
-
execute
Description copied from interface:CommandExecutorExecutes a command and returns the result with output callback.- Specified by:
executein interfaceCommandExecutor- Parameters:
command- the command to executecallback- the callback for real-time output (may be null)- Returns:
- the result of command execution
- Throws:
IOException- if command execution fails
-
executeSudo
Description copied from interface:CommandExecutorExecutes a command with sudo privileges.- Specified by:
executeSudoin interfaceCommandExecutor- Parameters:
command- the command to execute with sudo- Returns:
- the result of command execution
- Throws:
IOException- if command execution fails or SUDO_PASSWORD is not set
-
executeSudo
public Node.CommandResult executeSudo(String command, Node.OutputCallback callback) throws IOException Description copied from interface:CommandExecutorExecutes a command with sudo privileges and output callback.- Specified by:
executeSudoin interfaceCommandExecutor- Parameters:
command- the command to execute with sudocallback- the callback for real-time output (may be null)- Returns:
- the result of command execution
- Throws:
IOException- if command execution fails or SUDO_PASSWORD is not set
-
getIdentifier
Description copied from interface:CommandExecutorGets a short identifier for this executor (e.g., hostname).- Specified by:
getIdentifierin interfaceCommandExecutor- Returns:
- the identifier string
-