Six symbols were referenced across the codebase but had no definition anywhere. Star-imports from lib_provisioning/mod.nu silenced the missing-def errors at parse time; at runtime the call sites either threw or took dead code paths. ADR-025 Phase 2 (AST audit) surfaced them as blockers for Phase 3 because selective imports would expose them as "variable not found" errors. Resolution: add stub getters in lib_provisioning/config/accessor/functions.nu following the existing pattern (env -> config -> PROVISIONING-derived -> ""): - get-providers-path (14 call sites) - get-prov-lib-path (2 call sites) - get-core-nulib-path (7 call sites) - get-provisioning-generate-dirpath (5 call sites) - get-provisioning-generate-defsfile (1 call site) - get-provisioning-req-versions (4 call sites) All existing callers already guard results with is-empty / path exists checks, so empty-string returns fall back to safe no-op paths. show_tools_info (main_provisioning/tools.nu) was missing a guard around its open call; added is-empty / path-exists check matching sibling fns. The only non-path symbol (on_clusters in clusters/create.nu) had no recoverable implementation; its closure is replaced with a user-facing message directing to 'prvng cluster deploy' (the supported workflow). Refs: ADR-025, .coder/benchmarks/phase2-findings.md blockers section
81 lines
3.6 KiB
Text
81 lines
3.6 KiB
Text
use lib_provisioning *
|
|
#use ../lib_provisioning/utils/generate.nu *
|
|
use utils.nu *
|
|
# Provider middleware now available through lib_provisioning
|
|
|
|
# > Clusters services
|
|
export def "main create" [
|
|
name?: string # Server hostname in settings
|
|
...args # Args for create command
|
|
--infra (-i): string # infra directory
|
|
--settings (-s): string # Settings path
|
|
--outfile (-o): string # Output file
|
|
--cluster_pos (-p): int # Server position in settings
|
|
--check (-c) # Only check mode no clusters will be created
|
|
--wait (-w) # Wait clusters to be created
|
|
--select: string # Select with task as option
|
|
--debug (-x) # Use Debug mode
|
|
--xm # Debug with PROVISIONING_METADATA
|
|
--xc # Debuc for task and services locally PROVISIONING_DEBUG_CHECK
|
|
--xr # Debug for remote clusters PROVISIONING_DEBUG_REMOTE
|
|
--xld # Log level with DEBUG PROVISIONING_LOG_LEVEL=debug
|
|
--metadata # Error with metadata (-xm)
|
|
--notitles # not tittles
|
|
--helpinfo (-h) # For more details use options "help" (no dashes)
|
|
--out: string # Print Output format: json, yaml, text (default)
|
|
] {
|
|
if ($out | is-not-empty) {
|
|
$env.PROVISIONING_OUT = $out
|
|
$env.PROVISIONING_NO_TERMINAL = true
|
|
}
|
|
provisioning_init $helpinfo "cluster create" $args
|
|
#parse_help_command "cluster create" $name --ismod --end
|
|
# print "on cluster main create"
|
|
if $debug { $env.PROVISIONING_DEBUG = true }
|
|
if $metadata { $env.PROVISIONING_METADATA = true }
|
|
if $name != null and $name != "h" and $name != "help" {
|
|
let curr_settings = (find_get_settings --infra $infra --settings $settings)
|
|
if ($curr_settings.data.clusters | find $name| length) == 0 {
|
|
_print $"🛑 invalid name ($name)"
|
|
exit 1
|
|
}
|
|
}
|
|
let task = if ($args | length) > 0 {
|
|
($args| get 0)
|
|
} else {
|
|
let str_task = (($env.PROVISIONING_ARGS? | default "") | str replace "create " " " )
|
|
let str_task = if $name != null {
|
|
($str_task | str replace $name "")
|
|
} else {
|
|
$str_task
|
|
}
|
|
($str_task | str trim | split row " " | first | default "" | split row "-" | first | default "" | str trim)
|
|
}
|
|
let other = if ($args | length) > 0 { ($args| skip 1) } else { "" }
|
|
let ops = $"($env.PROVISIONING_ARGS? | default "") " | str replace $"($task) " "" | str trim
|
|
let run_create = {
|
|
# on_clusters is not defined anywhere in the codebase; cluster-create via
|
|
# this entrypoint was dead at runtime. The workflow now lives in
|
|
# main_provisioning/cluster-deploy.nu (prvng cluster deploy).
|
|
_print $"(_ansi yellow)cluster create via this command is not wired(_ansi reset) — use 'prvng cluster deploy <layer> <cluster>' instead."
|
|
}
|
|
match $task {
|
|
"" if $name == "h" => {
|
|
^$"($env.PROVISIONING_NAME)" -mod cluster create help --notitles
|
|
},
|
|
"" if $name == "help" => {
|
|
^$"($env.PROVISIONING_NAME)" -mod cluster create --help
|
|
print (provisioning_options "create")
|
|
},
|
|
"" => {
|
|
let result = desktop_run_notify $"($env.PROVISIONING_NAME) clusters create" "-> " $run_create --timeout 11sec
|
|
#do $run_create
|
|
},
|
|
_ => {
|
|
if $task != "" { print $"🛑 invalid_option ($task)" }
|
|
print $"\nUse (_ansi blue_bold)($env.PROVISIONING_NAME) -h(_ansi reset) for help on commands and options"
|
|
}
|
|
}
|
|
# "" | "create"
|
|
if not $env.PROVISIONING_DEBUG { end_run "" }
|
|
}
|