#3431 fix: surface subprocess stdout/stderr in CommandAuthenticator failures
Pull request opened by
AdilFayyaz
Why are the changes needed?
When CommandAuthenticator runs an external token command (e.g. az account get-access-token) and the command fails, flytekit raises a generic AuthenticationError and discards the command's captured output. Useful messages from the underlying CLI — such as "Please run 'az login' to setup account" — never reach the user, generating avoidable support questions.
What changes were proposed in this pull request?
• CommandAuthenticator.refresh_credentials now binds the CalledProcessError and includes e.stdout / e.stderr in both the logging.error line and the raised AuthenticationError message.
• No CLI-specific text is hardcoded; the upstream tool's own message is propagated as-is.
• Existing success path and FileNotFoundError behavior are unchanged.
How was this patch tested?
• Updated test_command_authenticator to simulate a CalledProcessError carrying output="some stdout output" and stderr="Please run 'az login' to setup account", asserting both substrings appear in the raised AuthenticationError.
• Run: uv run pytest tests/flytekit/unit/clients/auth/test_authenticator.py -x — all 6 tests pass.
Check all the applicable boxes
• I updated the documentation accordingly.
• All new and existing tests passed.
• All commits are signed-off.
Related PRs
Docs link
flyteorg/flytekit