airflow-commits mailing list archives

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

             Summary: Empty env vars do not overwrite non-empty config values
                 Key: AIRFLOW-694
             Project: Apache Airflow
          Issue Type: Bug
          Components: core
    Affects Versions: Airflow
            Reporter: Rolf Schroeder
            Priority: Minor

Setting an empty environment variable, ex:


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/]
    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.

This message was sent by Atlassian JIRA

View raw message