Hey :wave: Opened a small bug-fix PR for the atmos...
# pr-reviews
m
Hey 👋 Opened a small bug-fix PR for the atmos ansible playbook command: https://github.com/cloudposse/atmos/pull/2594 Bug: any atmos ansible playbook <component> -s <stack> -- <ansible-args> (e.g. -- --check) fails with a misleading Unknown command \<component>`instead of running the playbook. So there's currently no way to pass native
ansible-playbook
flags through. Cause: playbookCmd uses cobra.ExactArgs(1), which counts the passthrough tokens after -- as extra positional args; validation fails and the root UsageFunc renders it as "Unknown command". Fix: separator-aware validator that counts only the args before -- (via cobra.ArgsLenAtDash()), matching how terraform / auth shell|exec already handle passthrough. The executor already forwards post--- args, so this was the only gap. One-function change + regression test, cmd/ansible tests green. Repro'd on v1.220.0. Would appreciate a review when someone has a cycle 🙏
e
There's definitely a bug, but there's already a solution/pattern to follow for this
We use a pkg called the flag handler, so we centralize all the parsing and handling. Cobra is such a pain to get right.
👀 1
m
I poked it a bit more, and now there's a decision to be made - https://github.com/cloudposse/atmos/pull/2594#issuecomment-4675558901
e
Let me see if I can get. you a better answer.
We had a lot of problems when we used
DisableFlagParsing=true
before introducing the flag-handler.
💬 on PR
👀 1
m
Another attempt pushed, thanks
e
@Andriy Knysh (Cloud Posse) LGTM
❤️ 1
we can merge
👀 1
merged 1
a
merged, thanks @Marat Bakeev
❤️ 1
m
Thanks for quick reaction, guys! Yes, we are wiring in ansible with atmos %)
👍 1