airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRFLOW-694) Empty env vars do not overwrite non-empty config values
Date Thu, 02 Feb 2017 13:39:51 GMT

    [ https://issues.apache.org/jira/browse/AIRFLOW-694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15849911#comment-15849911
] 

ASF subversion and git services commented on AIRFLOW-694:
---------------------------------------------------------

Commit 3e6b923f88ea012b750e1d8c089dffa5e70a586e in incubator-airflow's branch refs/heads/master
from [~sekikn]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-airflow.git;h=3e6b923 ]

[AIRFLOW-694] Fix config behaviour for empty envvar

Currently, environment variable with empty value
does not overwrite the
configuration value corresponding to it.

Closes #2044 from sekikn/AIRFLOW-694


> Empty env vars do not overwrite non-empty config values
> -------------------------------------------------------
>
>                 Key: AIRFLOW-694
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-694
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: core
>    Affects Versions: Airflow 1.7.1.3
>            Reporter: Rolf Schroeder
>            Assignee: Kengo Seki
>            Priority: Minor
>             Fix For: 1.8.1
>
>
> Setting an empty environment variable, ex:
> {noformat}export AIRFLOW__SMTP__SMTP_PASSWORD=""{noformat}
> will not overwrite any config variable which is not empty, ex
> {noformat}
> ...
> [smtp]
> smtp_password = airflow
> {noformat}
> I know that I could simply modify the values in aiflow.cfg. However, my expectation (according
to the docs) was that env vars always overwrite default values. This is clearly not the case.
> {code:title=airflow/configuration.py|borderStyle=solid}
>     def get(self, section, key, **kwargs):
>         section = str(section).lower()
>         key = str(key).lower()
>         # first check environment variables
>         option = self._get_env_var_option(section, key)
>         if option: ## !!!!! empty string will evaluate to False !!!!!
>             return option
>         # ...then the config file
>         if self.has_option(section, key):
>             return expand_env_var(
>                 ConfigParser.get(self, section, key, **kwargs))
> {code}
> If the env var is empty, it will not get used.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message