This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 9fecfd5d995 Fix config update --option/--ignore-option never matching 
options (#70240)
9fecfd5d995 is described below

commit 9fecfd5d995a965418df6d1c30e2698a9bea85ac
Author: SreeramaYeshwanthGowd <[email protected]>
AuthorDate: Thu Jul 30 16:47:02 2026 +0530

    Fix config update --option/--ignore-option never matching options (#70240)
---
 airflow-core/newsfragments/70240.bugfix.rst        |  1 +
 .../src/airflow/cli/commands/config_command.py     |  5 ++--
 .../tests/unit/cli/commands/test_config_command.py | 33 ++++++++++++++++++++++
 3 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/airflow-core/newsfragments/70240.bugfix.rst 
b/airflow-core/newsfragments/70240.bugfix.rst
new file mode 100644
index 00000000000..66f3608b20a
--- /dev/null
+++ b/airflow-core/newsfragments/70240.bugfix.rst
@@ -0,0 +1 @@
+Fix ``airflow config update --option`` and ``--ignore-option`` never matching 
any configuration option.
diff --git a/airflow-core/src/airflow/cli/commands/config_command.py 
b/airflow-core/src/airflow/cli/commands/config_command.py
index 548a2a21e05..5f087fdfa4c 100644
--- a/airflow-core/src/airflow/cli/commands/config_command.py
+++ b/airflow-core/src/airflow/cli/commands/config_command.py
@@ -1016,13 +1016,12 @@ def update_config(args) -> None:
             continue
         conf_section = change.config.section.lower()
         conf_option = change.config.option.lower()
-        full_key = f"{conf_section}.{conf_option}"
 
         if update_sections_lower is not None and conf_section not in 
update_sections_lower:
             continue
-        if update_options_lower is not None and full_key not in 
update_options_lower:
+        if update_options_lower is not None and conf_option not in 
update_options_lower:
             continue
-        if conf_section in ignore_sections_lower or full_key in 
ignore_options_lower:
+        if conf_section in ignore_sections_lower or conf_option in 
ignore_options_lower:
             continue
 
         if conf_section not in config_dict or conf_option not in 
config_dict[conf_section]:
diff --git a/airflow-core/tests/unit/cli/commands/test_config_command.py 
b/airflow-core/tests/unit/cli/commands/test_config_command.py
index 00855442262..ecbb31fbb19 100644
--- a/airflow-core/tests/unit/cli/commands/test_config_command.py
+++ b/airflow-core/tests/unit/cli/commands/test_config_command.py
@@ -607,3 +607,36 @@ class TestCliConfigUpdate:
         assert os.path.exists(backup_path), "Backup file should be created."
         backup_content = open(backup_path).read()
         assert "backup_config" in backup_content, "Backup file should contain 
the original content."
+
+    @pytest.mark.parametrize(
+        ("flag", "present_key", "absent_key"),
+        [
+            ("--option", "core/dag_concurrency", "core/worker_precheck"),
+            ("--ignore-option", "core/worker_precheck", 
"core/dag_concurrency"),
+        ],
+    )
+    def test_update_config_filters_by_bare_option_name(
+        self, flag, present_key, absent_key, tmp_path, monkeypatch, capsys
+    ):
+        cfg_file = tmp_path / "airflow.cfg"
+        cfg_file.write_text("[core]\ndag_concurrency = 16\nworker_precheck = 
True\n")
+        monkeypatch.setattr(config_command, "AIRFLOW_CONFIG", str(cfg_file))
+        monkeypatch.setattr(
+            conf,
+            "as_dict",
+            lambda *args, **kwargs: {
+                "core": {
+                    "dag_concurrency": ("16", "airflow.cfg"),
+                    "worker_precheck": ("True", "airflow.cfg"),
+                }
+            },
+        )
+        monkeypatch.setattr(conf, "write_custom_config", lambda file, 
**kwargs: file.write(""))
+
+        parser = cli_parser.get_parser()
+        args = parser.parse_args(["config", "update", "--all-recommendations", 
flag, "dag_concurrency"])
+        config_command.update_config(args)
+
+        output = capsys.readouterr().out
+        assert f"'{present_key}'" in output
+        assert f"'{absent_key}'" not in output

Reply via email to