ashb commented on a change in pull request #4705: [AIRFLOW-3743] Unify
different methods of working out AIRFLOW_HOME
URL: https://github.com/apache/airflow/pull/4705#discussion_r268362887
##########
File path: airflow/configuration.py
##########
@@ -530,6 +530,24 @@ def parameterized_config(template):
conf.read(AIRFLOW_CONFIG)
+if conf.has_option('core', 'AIRFLOW_HOME'):
+ if 'AIRFLOW_HOME' in os.environ:
+ warnings.warn(
+ 'Specifying both AIRFLOW_HOME environment variable and
airflow_home '
+ 'in the config file is deprecated. Please use only the
AIRFLOW_HOME '
+ 'environment variable and remove the config file entry.',
+ category=DeprecationWarning,
+ )
+ else:
+ AIRFLOW_HOME = conf.get('core', 'airflow_home')
Review comment:
I've changed it to:
```python
if conf.has_option('core', 'AIRFLOW_HOME'):
msg = (
'Specifying both AIRFLOW_HOME environment variable and airflow_home '
'in the config file is deprecated. Please use only the AIRFLOW_HOME '
'environment variable and remove the config file entry.'
)
if 'AIRFLOW_HOME' in os.environ:
warnings.warn(msg, category=DeprecationWarning,)
elif conf.get('core', 'airflow_home') == AIRFLOW_HOME:
warnings.warn(
'Specifying airflow_home in the config file is deprecated. As
you '
'have left it at the default value you should remove the setting
'
'from your airflow.cfg and suffer no change in behaviour.',
category=DeprecationWarning,
)
else:
AIRFLOW_HOME = conf.get('core', 'airflow_home')
warnings.warn(msg, category=DeprecationWarning,)
```
I thought about adding an extra case do say which value it was
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services