github-actions[bot] opened a new pull request, #72565:
URL: https://github.com/apache/airflow/pull/72565

   * Fix DAG.cli() crashing on dags pause and unpause
   
   A Dag file run as a script goes through DAG.cli(), whose parser drops
   --dag-id and instead dispatches every subcommand with the Dag object as
   a second positional argument. The pause and unpause handlers never
   accepted it, so Dag authors got a TypeError instead of the command.
   
   The handlers are only reachable this way from a Dag file, which is why
   the regular `airflow dags pause` path has always worked and no test
   covered the difference.
   
   * Ignore --treat-dag-id-as-regex when DAG.cli() supplies the Dag
   
   The Dag-scoped parser drops --dag-id but keeps --treat-dag-id-as-regex,
   so the flag survives into a context where the user has no pattern left
   to supply. The Dag's own id was then read back as a pattern, and dag_ids
   may contain dots, so an unanchored match could pause unrelated Dags.
   
   Normalising the flag next to the dag_id it guards covers both of its
   readers, including the confirmation prompt, rather than guarding each
   reader in turn and leaving the next one to be found later.
   
   * Update airflow-core/tests/unit/cli/commands/test_dag_command.py
   
   ---------
   (cherry picked from commit bcc430f58359dd68f7dfa2e4fa1d547ea6a2e04e)
   
   Co-authored-by: Y-C <[email protected]>
   Co-authored-by: Eason09053360 
<[email protected]>
   Co-authored-by: Henry Chen <[email protected]>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to