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

Tanay Tummalapalli commented on AIRFLOW-3742:
---------------------------------------------

getboolean raises an AirflowConfigException in the same case where the value 
cannot be casted to the desired type(getint and getfloat raise ValueError). 
Shouldn't the type of exception raised in the same case be the same?

More tests can be added to test the following cases:
 # value of a key in config that cannot be casted to the desired type, raises 
an Exception.
 # type of a value, of a key in config, is as desired(bool, int, float)
 # getboolean returns the correct value for all the aliases for the bool 
values('t', 'true', '1', etc.)
 # getboolean works fine with inline comments 
(https://github.com/apache/airflow/commit/6c59c78134d18dbfe58cc8baafbb9af311b46051)

> airflow.configuration doesn't respect fallback kwarg
> ----------------------------------------------------
>
>                 Key: AIRFLOW-3742
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3742
>             Project: Apache Airflow
>          Issue Type: Improvement
>          Components: configuration
>            Reporter: Ash Berlin-Taylor
>            Assignee: Ash Berlin-Taylor
>            Priority: Minor
>             Fix For: 1.10.3
>
>
> The ConfigParser class we base our config parser on can optionally accept a 
> fallback argument:
> {code:python}
> conf.get('sect', 'key', fallback='default')
> {code}
> but our sub-class doesn't support this. It would be nice if we did. Then we 
> can turn
> {code:python}
> plugins_folder = configuration.conf.get('core', 'plugins_folder')
> if not plugins_folder:
>     plugins_folder = settings.AIRFLOW_HOME + '/plugins'
> {code}
> in to this:
> {code:python}
> plugins_folder = configuration.conf.get('core', 'plugins_folder', 
> fallback=settings.AIRFLOW_HOME + '/plugins')
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to