Skip to content

Commit dc45f53

Browse files
LTSCommerceclaude
andcommitted
fix(run.bash): apply sudo -k -n true to the MAIN playbook call too (v1.7.3)
v1.7.2 used a replace_all that only matched the 2-space-indented `sudo -n true` inside run_playbook_with_issue_option. The main-playbook gate at top level is unindented, so it was never changed — and that is the line that decides --ask-become-pass for the preflight/main run. Result: v1.7.2 bumped the version and fixed the helper but left the actual become gate on the old cached-ticket logic, so preflight still died with "premature end of stream waiting for become success" and ansible never prompted for the password. Both call sites now use `sudo -k -n true`, so a password-sudo machine (verified: `sudo -k -n true` exits 1) correctly routes to --ask-become-pass and ansible prompts for the BECOME password. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent b49746b commit dc45f53

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

run.bash

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Setup
44
## !! BUMP THIS VERSION ON EVERY CHANGE TO THIS FILE — NO EXCEPTIONS !!
55
## !! If you forget, there is NO WAY to tell which version is running !!
6-
RUN_BASH_VERSION="1.7.2" # Fix: detect genuine NOPASSWD sudo with `sudo -k -n true` so password-sudo machines use --ask-become-pass (cached ticket no longer masks it -> no "premature end of stream waiting for become success")
6+
RUN_BASH_VERSION="1.7.3" # Fix: the v1.7.2 sudo -k -n true change missed the MAIN playbook call (different indentation) — that unindented `sudo -n true` is what gated preflight, so become still failed. Now fixed on both call sites.
77

88
# ── Sourced-shell pollution guard (H4) ───────────────────────────────────────
99
# The documented install is `(source <(curl ... run.bash))` — sourced INSIDE a
@@ -1516,10 +1516,16 @@ echo -e "${YELLOW}${INFO} This may take several minutes...${NC}\n"
15161516
# failure is handled here instead of silently aborting.
15171517
main_exit_code=0
15181518

1519-
if sudo -n true 2>/dev/null; then
1519+
# -k ignores any cached sudo timestamp, so this is true ONLY for genuine
1520+
# passwordless (NOPASSWD) sudo. Without -k, an earlier `sudo` in this run
1521+
# leaves a cached ticket that makes this pass, skipping --ask-become-pass —
1522+
# but ansible become runs in its own tty (Fedora tty_tickets) and can't use
1523+
# that cache, so it fails with "premature end of stream waiting for become
1524+
# success". Detecting real NOPASSWD here routes password sudo to --ask-become-pass.
1525+
if sudo -k -n true 2>/dev/null; then
15201526
./playbooks/playbook-main.yml || main_exit_code=$?
15211527
else
1522-
echo -e "${YELLOW}${INFO} You will be prompted for your sudo password${NC}"
1528+
echo -e "${YELLOW}${INFO} sudo needs a password — Ansible will now prompt you for it (BECOME password)${NC}"
15231529
./playbooks/playbook-main.yml --ask-become-pass || main_exit_code=$?
15241530
fi
15251531

0 commit comments

Comments
 (0)