From 29c2702c923dc4c08741cb90a90ff0e0fb549451 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 5 Oct 2018 00:01:43 -0700 Subject: [PATCH] [AIRFLOW-3099] Complete list of optional airflow.cfg sections --- airflow/bin/cli.py | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/airflow/bin/cli.py b/airflow/bin/cli.py index dbab8b38d89e9..14928bbd4802b 100644 --- a/airflow/bin/cli.py +++ b/airflow/bin/cli.py @@ -488,6 +488,24 @@ def _run(args, dag, ti): @cli_utils.action_logging def run(args, dag=None): + # Optional sections won't log an error if they're missing in airflow.cfg. + OPTIONAL_AIRFLOW_CFG_SECTIONS = [ + 'atlas', + 'celery', + 'celery_broker_transport_options', + 'dask', + 'elasticsearch', + 'github_enterprise', + 'hive', + 'kerberos', + 'kubernetes', + 'kubernetes_node_selectors', + 'kubernetes_secrets', + 'ldap', + 'lineage', + 'mesos', + ] + if dag: args.dag_id = dag.dag_id @@ -510,18 +528,15 @@ def run(args, dag=None): try: conf.set(section, option, value) except NoSectionError: - optional_sections = [ - 'atlas', 'mesos', 'elasticsearch', 'kubernetes', - 'lineage', 'hive' - ] - if section in optional_sections: - log.debug('Section {section} Option {option} ' - 'does not exist in the config!'.format(section=section, - option=option)) + no_section_msg = ( + 'Section {section} Option {option} ' + 'does not exist in the config!' + ).format(section=section, option=option) + + if section in OPTIONAL_AIRFLOW_CFG_SECTIONS: + log.debug(no_section_msg) else: - log.error('Section {section} Option {option} ' - 'does not exist in the config!'.format(section=section, - option=option)) + log.error(no_section_msg) settings.configure_vars()