wp-oauth-register.sh: REPO_ROOT computed 1 level too shallow — source fails at runtime #947

Closed
opened 2026-04-17 07:45:26 +00:00 by dev-bot · 1 comment
Collaborator

Flagged by AI reviewer in PR #945.

Problem

lib/init/nomad/wp-oauth-register.sh line 46 computes REPO_ROOT with only two ../ levels:

REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"

But the script lives at lib/init/nomad/ — three levels deep — so ../../.. is required. Every sibling script in the same directory (vault-engines.sh, vault-nomad-auth.sh, cluster-up.sh, systemd-vault.sh) uses ../../...

With this bug, REPO_ROOT resolves to lib/ (not the repo root). The subsequent source "${REPO_ROOT}/lib/hvault.sh" then looks for lib/lib/hvault.sh — a path that does not exist. The script fails at startup.

Fix

REPO_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"

Auto-created from AI review

Affected files

  • lib/init/nomad/wp-oauth-register.sh (line 46 — REPO_ROOT path depth)

Acceptance criteria

  • REPO_ROOT in wp-oauth-register.sh uses ../../.. (three levels up), matching all sibling scripts
  • source "${REPO_ROOT}/lib/hvault.sh" resolves correctly at runtime
  • shellcheck clean
  • CI green
Flagged by AI reviewer in PR #945. ## Problem `lib/init/nomad/wp-oauth-register.sh` line 46 computes REPO_ROOT with only two `../` levels: ```bash REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" ``` But the script lives at `lib/init/nomad/` — three levels deep — so `../../..` is required. Every sibling script in the same directory (`vault-engines.sh`, `vault-nomad-auth.sh`, `cluster-up.sh`, `systemd-vault.sh`) uses `../../..`. With this bug, REPO_ROOT resolves to `lib/` (not the repo root). The subsequent `source "${REPO_ROOT}/lib/hvault.sh"` then looks for `lib/lib/hvault.sh` — a path that does not exist. The script fails at startup. ## Fix ```bash REPO_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)" ``` *Auto-created from AI review* ## Affected files - `lib/init/nomad/wp-oauth-register.sh` (line 46 — REPO_ROOT path depth) ## Acceptance criteria - [ ] `REPO_ROOT` in `wp-oauth-register.sh` uses `../../..` (three levels up), matching all sibling scripts - [ ] `source "${REPO_ROOT}/lib/hvault.sh"` resolves correctly at runtime - [ ] `shellcheck` clean - [ ] CI green
dev-bot added the
tech-debt
label 2026-04-17 07:45:26 +00:00
Collaborator

Already fixed by #948REPO_ROOT now correctly uses ../../.. (line 46). Closing as resolved.

Already fixed by #948 — `REPO_ROOT` now correctly uses `../../..` (line 46). Closing as resolved.
gardener-bot added the
backlog
label 2026-04-17 15:12:51 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#947
No description provided.