[nomad-step-2] S2-fix-B — extract _hvault_default_env helper to lib/hvault.sh (prereq for other S2 fixes) #919
Labels
No labels
action
backlog
blocked
bug-report
cannot-reproduce
in-progress
in-triage
needs-triage
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
rejected
reproduced
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#919
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of the Nomad+Vault migration. Step-2 sub-bugfix (1/4). Replaces part of the consolidated #912.
Goal
Extract the
VAULT_ADDR+VAULT_TOKENdefault-to-local-cluster fallback into a single shared helper inlib/hvault.sh, callable from every Vault-touching script.Why
disinto init --backend=nomadwrites/etc/profile.d/disinto-nomad.shbut doesn't source it in the current process. Downstream scripts (vault-apply-policies.sh, vault-import.sh, vault-nomad-auth.sh, vault-apply-roles.sh) error "VAULT_ADDR not set" on the first invocation. Operators work around it by manually exporting, but the hero command should Just Work.The previous attempt at this fix (#917, #918) failed the duplicate-detection CI gate because dev-qwen2 copy-pasted the defaulting block into two places. One shared helper, one call site per script.
Scope
In
lib/hvault.shAdd a function near the top (before any other function definitions):
Call sites that must replace any inline defaulting with a sourced call
tools/vault-apply-policies.sh— at the top afterset -euo pipefail, addsource "$(dirname "$0")/../lib/hvault.sh" && _hvault_default_env.tools/vault-import.sh— same.tools/vault-apply-roles.sh— same.lib/init/nomad/vault-nomad-auth.sh— same (adjust relative path to../../lib/hvault.sh).Inline
VAULT_ADDR="${VAULT_ADDR:-...}"/cat /etc/vault.d/root.tokenblocks must be removed from the above files — they are now the shared helper's job.Acceptance criteria
grep -R 'VAULT_ADDR=\${VAULT_ADDR' tools/ lib/init/nomad/returns no matches (the helper is the only place with a default).grep -R '/etc/vault.d/root.token' tools/ lib/init/nomad/ lib/hvault.sh | wc -lshows exactly 1 (the helper)..woodpecker/ci.yml's duplicate-detection step passes.disinto init --backend=nomad --emptyworks without any pre-exportedVAULT_*env vars.shellcheckclean.Non-goals
lib/hvault.sh— just this one function.Labels / meta
[nomad-step-2] S2-fix-B— no dependencies. Prerequisite for S2-fix-A.Resolved by merged PR #923 (merge commit
cfe1ef95) which landed all 4 sub-issue fixes at once. Closing as superseded.Blocked — issue #919
closed_externally2026-04-16T21:31:31Z