Skip to content

[airflow-ctl/v0-1-test] Fix airflowctl commands crashing instead of printing their result (#72675) - #73988

Merged
henry3260 merged 1 commit into
apache:airflow-ctl/v0-1-testfrom
henry3260:backport-f31b572-airflow-ctl/v0-1-test
Oct 1, 2026
Merged

henry3260 merged 1 commit into
apache:airflow-ctl/v0-1-testfrom
henry3260:backport-f31b572-airflow-ctl/v0-1-test

Conversation

@henry3260

@henry3260 henry3260 commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Backport of #72675 to airflow-ctl/v0-1-test.

Why

airflowctl generates its commands from the operations layer, and every generated
command finishes by printing through args.output. That flag was only declared for
commands whose method name happened to start with one of ten CRUD verbs, so the ones
that did not — assets materialize, backfill pause|unpause|cancel and
connections test — reached the printer with the attribute undefined and died with a
raw traceback, after their request had already been sent and applied server-side.

-e/--env deliberately keeps its existing whitelist. Nothing reads args.env for
generated commands, so widening it would only let more commands silently accept an
environment they then ignore and run against production credentials instead; that is
tracked separately in #70519.

The bug is present on this branch. With the fix reverted, both tests this commit adds
fail here:

AttributeError: 'Namespace' object has no attribute 'output'
  at airflow-ctl/src/airflowctl/ctl/cli_config.py:818  ->  output=args.output

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

…ache#72675)

airflowctl generates its commands from the operations layer, and every
generated command finishes by printing through ``args.output``. That flag
was only declared for commands whose method name happened to start with
one of ten CRUD verbs, so the ones that did not — ``assets materialize``,
``backfill pause|unpause|cancel`` and ``connections test`` — reached the
printer with the attribute undefined and died with a raw traceback, after
their request had already been sent and applied server-side.

``-e/--env`` deliberately keeps its existing whitelist. Nothing reads
``args.env`` for generated commands, so widening it would only let more
commands silently accept an environment they then ignore and run against
production credentials instead; that is tracked separately in
apache#70519.

Co-authored-by: Eason09053360 <[email protected]>
(cherry picked from commit f31b572)

The pick is not clean, because this branch does not carry the commit that
introduced ``_call_generated_command`` and the ``test_primitive_param_*``
tests. Git offered those alongside this change in the conflict; they are
left out, since they belong to that commit rather than this one, as do the
``ClearTaskInstancesBody`` and ``DagRunOperations`` imports they need.
``from unittest import mock`` is plain context on main and is added here
for the same reason: the test this commit adds needs it, and the commit
that would have brought it is not on this branch.
@henry3260
henry3260 merged commit eaff9eb into apache:airflow-ctl/v0-1-test Oct 1, 2026
2 checks passed
shahar1 pushed a commit that referenced this pull request Nov 19, 2026
…2675) (#73988)

airflowctl generates its commands from the operations layer, and every
generated command finishes by printing through ``args.output``. That flag
was only declared for commands whose method name happened to start with
one of ten CRUD verbs, so the ones that did not — ``assets materialize``,
``backfill pause|unpause|cancel`` and ``connections test`` — reached the
printer with the attribute undefined and died with a raw traceback, after
their request had already been sent and applied server-side.

``-e/--env`` deliberately keeps its existing whitelist. Nothing reads
``args.env`` for generated commands, so widening it would only let more
commands silently accept an environment they then ignore and run against
production credentials instead; that is tracked separately in
#70519.

Co-authored-by: Eason09053360 <[email protected]>
(cherry picked from commit f31b572)

The pick is not clean, because this branch does not carry the commit that
introduced ``_call_generated_command`` and the ``test_primitive_param_*``
tests. Git offered those alongside this change in the conflict; they are
left out, since they belong to that commit rather than this one, as do the
``ClearTaskInstancesBody`` and ``DagRunOperations`` imports they need.
``from unittest import mock`` is plain context on main and is added here
for the same reason: the test this commit adds needs it, and the commit
that would have brought it is not on this branch.

Co-authored-by: Y-C <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants