provisioning/core/nulib/main_provisioning/status.nu

49 lines
2.1 KiB
Plaintext
Raw Normal View History

# -> Manage provisioning Servers or instances
export def "main status" [
target?: string # server (s) | taskserv (t) | cluster (c)
name?: string # Target name in settings
...args # Args for create command
--serverpos (-p): int # Server position in settings
--check (-c) # Only check mode no servers will be created
--wait (-w) # Wait servers to be created
--infra (-i): string # Infra path
--settings (-s): string # Settings path
--outfile (-o): string # Output file
--debug (-x) # Use Debug mode
--xm # Debug with PROVISIONING_METADATA
--xc # Debuc for task and services locally PROVISIONING_DEBUG_CHECK
--xr # Debug for remote servers PROVISIONING_DEBUG_REMOTE
--xld # Log level with DEBUG PROVISIONING_LOG_LEVEL=debug
--metadata # Error with metadata (-xm)
--notitles # not tittles
--out: string # Print Output format: json, yaml, text (default)
]: nothing -> nothing {
let str_out = if ($out | is-not-empty) {
$env.PROVISIONING_OUT = $out
$env.PROVISIONING_NO_TERMINAL = true
$"--out ($out)"
} else {
""
}
parse_help_command "status" --end
if $debug { $env.PROVISIONING_DEBUG = true }
let use_debug = if $debug or $env.PROVISIONING_DEBUG { "-x" } else { "" }
match ($target | default "") {
"server"| "servers" | "s" => {
^$"($env.PROVISIONING_NAME)" $use_debug -mod "server" ($env.PROVISIONING_ARGS | str replace $target '') $str_out --yes --notitles
},
"taskserv" | "taskservs" | "t" => {
^$"($env.PROVISIONING_NAME)" $use_debug -mod "tasksrv" ($env.PROVISIONING_ARGS | str replace $target '') _out --yes --notitles
},
"clusters"| "clusters" | "c" => {
^$"($env.PROVISIONING_NAME)" $use_debug -mod "cluster" ($env.PROVISIONING_ARGS | str replace $target '') $str_out --yes --notitles
},
"" => {
^$"($env.PROVISIONING_NAME)" $use_debug -mod "server" ($env.PROVISIONING_ARGS) $str_out
},
_ => {
invalid_task "status" ($target | default "") --end
},
}
}