- DAG architecture: `dag show/validate/export` (nulib/main_provisioning/dag.nu),
config loader (lib_provisioning/config/loader/dag.nu), taskserv dag-executor.
Backed by schemas/lib/dag/*.ncl; orchestrator emits NATS events via
WorkspaceComposition::into_workflow. See ADR-020, ADR-021.
- Unified Component Architecture: components/mod.nu, main_provisioning/
{components,workflow,extensions,ontoref-queries}.nu. Full workflow engine with
topological sort and NATS subject emission. Blocks A-H complete (libre-daoshi).
- Commands-registry: nulib/commands-registry.ncl (Nickel source, 314 lines) +
JSON cache at ~/.cache/provisioning/commands-registry.json rebuilt on source
change. cli/provisioning fast-path alias expansion avoids cold Nu startup.
ADDING_COMMANDS.md documents new-command workflow.
- Platform service manager: service-manager.nu (+573), startup.nu (+611),
service-check.nu (+255); autostart/bootstrap/health/target refactored.
- Nushell 0.112.2 migration: removed all try/catch and bash redirections;
external commands prefixed with ^; type signatures enforced. Driven by
scripts/refactor-try-catch{,-simplified}.nu.
- TTY stack: removed shlib/*-tty.sh; replaced by cli/tty-dispatch.sh,
tty-filter.sh, tty-commands.conf.
- New domain modules: images/ (golden image lifecycle), workspace/{state,sync}.nu,
main_provisioning/{bootstrap,cluster-deploy,fip,state}.nu, commands/{state,
build,integrations/auth,utilities/alias}.nu, platform.nu expanded (+874).
- Config loader overhaul: loader/core.nu slimmed (-759), cache/core.nu
refactored (-454), removed legacy loaders/file_loader.nu (-330).
- Thirteen new provisioning-<domain>.nu top-level modules for bash dispatcher.
- Tests: test_workspace_state.nu (+351); updates to test_oci_registry,
test_services.
- README + CHANGELOG updated.
80 lines
3.2 KiB
Text
80 lines
3.2 KiB
Text
# REMOVED: use lib_provisioning * - causes circular import
|
|
use utils.nu *
|
|
use handlers.nu *
|
|
use ../lib_provisioning/config/accessor.nu *
|
|
use ../lib_provisioning/utils/error.nu [throw-error]
|
|
|
|
# > TaskServs Delete
|
|
export def "main delete" [
|
|
task_name?: string # Taskserv name to delete
|
|
server?: string # Server hostname (optional, all matching servers if omitted)
|
|
...args # Additional args
|
|
--infra (-i): string # Infra directory
|
|
--settings (-s): string # Settings path
|
|
--iptype: string = "public" # IP type to connect
|
|
--yes (-y) # Confirm delete without prompt
|
|
--force # Delete taskservs no longer in servers.ncl (reads from state file)
|
|
--debug (-x) # Use Debug mode
|
|
--xm # Debug with PROVISIONING_METADATA
|
|
--metadata # Error with metadata (-xm)
|
|
--notitles # No titles
|
|
--helpinfo (-h) # For more details use options "help" (no dashes)
|
|
--out: string # Print Output format: json, yaml, text (default)
|
|
] {
|
|
if ($out | is-not-empty) {
|
|
set-provisioning-out $out
|
|
set-provisioning-no-terminal true
|
|
}
|
|
provisioning_init $helpinfo "taskservs delete" ([($task_name | default "") ($server | default "")] | append $args)
|
|
if $debug { set-debug-enabled true }
|
|
if $metadata { set-metadata-enabled true }
|
|
|
|
match $task_name {
|
|
null | "h" => {
|
|
^$"((get-provisioning-name))" -mod taskserv delete --help --notitles
|
|
return
|
|
},
|
|
"help" => {
|
|
^$"((get-provisioning-name))" -mod taskserv delete --help
|
|
_print (provisioning_options "delete")
|
|
return
|
|
},
|
|
_ => {},
|
|
}
|
|
|
|
let curr_settings = (find_get_settings --infra $infra --settings $settings)
|
|
|
|
# Validate server exists in settings (server definitions are still needed for SSH even with --force)
|
|
if $server != null and $server != "" {
|
|
if ($curr_settings.data.servers | where hostname == $server | is-empty) {
|
|
_print $"🛑 server (_ansi red_bold)($server)(_ansi reset) not found in settings"
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
# Safety prompt
|
|
let target_desc = if ($server | is-not-empty) {
|
|
$"($task_name) on ($server)"
|
|
} else {
|
|
$"($task_name) on all matching servers"
|
|
}
|
|
let force_label = if $force { " (--force: reading from state)" } else { "" }
|
|
if not $yes {
|
|
_print $"Delete (_ansi red_bold)($target_desc)(_ansi reset)($force_label)? Type (_ansi green_bold)yes(_ansi reset): "
|
|
let user_input = (input --numchar 3)
|
|
if $user_input != "yes" and $user_input != "YES" {
|
|
_print "Aborted."
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
let run_delete = {
|
|
let curr_settings = (settings_with_env $curr_settings)
|
|
set-wk-cnprov $curr_settings.wk_path
|
|
let match_task = $task_name | default ""
|
|
let match_server = $server | default ""
|
|
on_taskservs $curr_settings $match_task "" $match_server $iptype false false false "delete" $force
|
|
}
|
|
let result = desktop_run_notify $"((get-provisioning-name)) taskserv delete" "-> " $run_delete --timeout 11sec
|
|
if not (is-debug-enabled) { end_run "" }
|
|
}
|