Class RunCLI
java.lang.Object
com.scivicslab.actoriac.cli.RunCLI
CLI subcommand to execute actor-IaC workflows.
This is the main workflow execution command. It supports executing workflows defined in YAML, JSON, or XML format with optional overlay configuration.
Usage
actor-iac run -d /path/to/workflows -w main-workflow.yaml actor-iac run --dir ./workflows --workflow deploy --threads 8 actor-iac run -d ./workflows -w deploy -i inventory.ini -g webservers
- Since:
- 2.10.0
- Author:
- devteam@scivics-lab.com
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final recordRecord for displaying workflow information. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate FileHandlerFile handler for loggingprivate Stringprivate Fileprivate Stringprivate booleanprivate static final Loggerprivate Fileprivate Fileprivate Stringprivate DistributedLogStoreDistributed log store (H2 database)private booleanprivate booleanprivate Fileprivate booleanprivate Fileprivate longCurrent session ID for distributed loggingprivate intprivate booleanCache of discovered workflow files: name -> Fileprivate Fileprivate String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncall()Executes the workflow.private voidconfigureLogLevel(boolean verbose) Configures log level based on verbose flag.private voidendSession(SessionStatus status) Ends the current session with the given status.private IntegerMain execution logic.private IntegerexecuteWorkflow(File mainWorkflowFile) Executes workflow with node-based execution.private static StringextractNameFromJson(File file) Extracts name field from JSON file.private static StringextractNameFromYaml(File file) Extracts name field from YAML file using simple line parsing.private static StringextractWorkflowName(File file) Extracts the workflow name from a YAML/JSON/XML file.findWorkflowFile(String name) Finds a workflow file by name.private static StringgetBaseName(String fileName) private booleanisWorkflowFile(Path path) Checks if a file is a workflow file (YAML, JSON, or XML).private com.scivicslab.pojoactor.core.ActionResultloadMainWorkflow(NodeGroupIIAR nodeGroupActor, File workflowFile, File overlayDir) Loads the main workflow file with optional overlay support.private voidLogs a message to the distributed log store if available.private voidprivate StringpromptForPassword(String prompt) Prompts for a password from the console.private voidregisterWorkflowFile(Path path) Registers a workflow file in the cache.private static Stringrelativize(Path base, Path target) private IntegerRenders overlay-applied workflows to the specified directory.private voidScans the directory recursively for workflow files.private static List<RunCLI.WorkflowDisplay> scanWorkflowsForDisplay(File directory) private voidSets up file logging with default or specified log file.private voidSets up H2 database for distributed logging.private voidSuppresses all console output (stdout/stderr) for quiet mode.
-
Field Details
-
LOG
-
workflowDir
-
workflowName
-
inventoryFile
-
groupName
-
threads
-
verbose
-
overlayDir
-
logFile
-
noLog
-
logDbPath
-
noLogDb
-
logServer
-
askPass
-
limitHosts
-
listWorkflows
-
quiet
-
renderToDir
-
workflowCache
Cache of discovered workflow files: name -> File -
fileHandler
File handler for logging -
logStore
Distributed log store (H2 database) -
sessionId
Current session ID for distributed logging
-
-
Constructor Details
-
RunCLI
public RunCLI()
-
-
Method Details
-
call
-
suppressConsoleOutput
Suppresses all console output (stdout/stderr) for quiet mode. -
setupLogDatabase
Sets up H2 database for distributed logging.- Throws:
SQLException
-
setupFileLogging
Sets up file logging with default or specified log file.- Throws:
IOException
-
configureLogLevel
Configures log level based on verbose flag. -
executeMain
Main execution logic. -
renderOverlayWorkflows
Renders overlay-applied workflows to the specified directory. -
executeWorkflow
Executes workflow with node-based execution. -
logToDb
-
endSession
Ends the current session with the given status. -
promptForPassword
Prompts for a password from the console. -
scanWorkflowDirectory
Scans the directory recursively for workflow files. -
isWorkflowFile
Checks if a file is a workflow file (YAML, JSON, or XML). -
registerWorkflowFile
Registers a workflow file in the cache. -
findWorkflowFile
Finds a workflow file by name. -
loadMainWorkflow
private com.scivicslab.pojoactor.core.ActionResult loadMainWorkflow(NodeGroupIIAR nodeGroupActor, File workflowFile, File overlayDir) Loads the main workflow file with optional overlay support. -
printWorkflowList
-
getBaseName
-
relativize
-
scanWorkflowsForDisplay
-
extractWorkflowName
Extracts the workflow name from a YAML/JSON/XML file. -
extractNameFromYaml
Extracts name field from YAML file using simple line parsing. -
extractNameFromJson
Extracts name field from JSON file.
-