MatrixManAtYrService opened a new issue, #27999:
URL: https://github.com/apache/airflow/issues/27999

   ### Apache Airflow version
   
   main (development)
   
   ### What happened
   
   Here's a dag:
   
   ```python3
   from airflow import DAG
   from airflow.decorators import task
   import airflow.configuration as conf
   from datetime import datetime
   
   @task
   def print_this(this):
       print(this)
   
   with DAG(dag_id="config_ref", schedule=None, start_date=datetime(1970, 1, 
1)) as dag:
       namespace = conf.get("kubernetes", "NAMESPACE")
       print_this(namespace)
   ```
   
   In 2.4.3 it parses without error, but in main (as of 
2e7a4bcb550538283f28550208b01515d348fb51) the reference to the "kubernetes" 
section breaks.  Likely because of this: 
https://github.com/apache/airflow/pull/26873
   ```
   ❯ airflow dags list-import-errors
   filepath                              | error
   
======================================+========================================================================================================
   /Users/matt/2022/11/29/dags/config.py | Traceback (most recent call last):
                                         |   File 
"/Users/matt/src/airflow/airflow/configuration.py", line 595, in get
                                         |     return 
self._get_option_from_default_config(section, key, **kwargs)
                                         |   File 
"/Users/matt/src/airflow/airflow/configuration.py", line 605, in 
_get_option_from_default_config
                                         |     raise 
AirflowConfigException(f"section/key [{section}/{key}] not found in config")
                                         | 
airflow.exceptions.AirflowConfigException: section/key  not found in config
                                         |
   
   ❯ python dags/config.py
   [2022-11-29 21:30:05,300] {configuration.py:603} WARNING - section/key 
[kubernetes/namespace] not found in config
   Traceback (most recent call last):
     File "/Users/matt/2022/11/29/dags/config.py", line 13, in <module>
       namespace = conf.get("kubernetes", "NAMESPACE")
     File "/Users/matt/src/airflow/airflow/configuration.py", line 1465, in get
       return conf.get(*args, **kwargs)
     File "/Users/matt/src/airflow/airflow/configuration.py", line 595, in get
       return self._get_option_from_default_config(section, key, **kwargs)
     File "/Users/matt/src/airflow/airflow/configuration.py", line 605, in 
_get_option_from_default_config
       raise AirflowConfigException(f"section/key [{section}/{key}] not found 
in config")
   airflow.exceptions.AirflowConfigException: section/key 
[kubernetes/namespace] not found in config
   ```
   
   To quote @jedcunningham :
   >  The backcompat layer only expects you to use the “new” section name.
   
   
   
   
   ### What you think should happen instead
   
   The recent section name change should be registered so that the old name 
still works.
   
   ### How to reproduce
   
   See above
   
   ### Operating System
   
   Mac OS / venv
   
   ### Versions of Apache Airflow Providers
   
   n/a
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   `pip install -e ~/src/airflow` into a fresh venv
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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