airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rolf Schroeder (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AIRFLOW-694) Empty env vars do not overwrite non-empty config values
Date Mon, 12 Dec 2016 19:54:59 GMT

     [ https://issues.apache.org/jira/browse/AIRFLOW-694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rolf Schroeder updated AIRFLOW-694:
-----------------------------------
    Description: 
Setting an empty environment variable, ex:

export AIRFLOW__SMTP__SMTP_PASSWORD=""

will not overwrite any config variable which is not empty, ex

smtp_password = airflow

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.

  was:
Setting an empty environment variable, ex:

export AIRFLOW__SMTP__SMTP_PASSWORD=""

will not overwrite any config variable which is not empty, ex

smtp_password = airflow

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.

[see airflow/configuration.py]
    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))


If the env var is empty, it will not get used.


> 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
>            Priority: Minor
>
> Setting an empty environment variable, ex:
> export AIRFLOW__SMTP__SMTP_PASSWORD=""
> will not overwrite any config variable which is not empty, ex
> smtp_password = airflow
> 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.4#6332)

Mime
View raw message