Skip to content

Commit 49e1c82

Browse files
changAlice Berard
authored and
Alice Berard
committed
[AIRFLOW-3099] Complete list of optional airflow.cfg sections (apache#4002)
1 parent 9a706fe commit 49e1c82

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

airflow/bin/cli.py

+26-11
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,24 @@ def _run(args, dag, ti):
488488

489489
@cli_utils.action_logging
490490
def run(args, dag=None):
491+
# Optional sections won't log an error if they're missing in airflow.cfg.
492+
OPTIONAL_AIRFLOW_CFG_SECTIONS = [
493+
'atlas',
494+
'celery',
495+
'celery_broker_transport_options',
496+
'dask',
497+
'elasticsearch',
498+
'github_enterprise',
499+
'hive',
500+
'kerberos',
501+
'kubernetes',
502+
'kubernetes_node_selectors',
503+
'kubernetes_secrets',
504+
'ldap',
505+
'lineage',
506+
'mesos',
507+
]
508+
491509
if dag:
492510
args.dag_id = dag.dag_id
493511

@@ -510,18 +528,15 @@ def run(args, dag=None):
510528
try:
511529
conf.set(section, option, value)
512530
except NoSectionError:
513-
optional_sections = [
514-
'atlas', 'mesos', 'elasticsearch', 'kubernetes',
515-
'lineage', 'hive'
516-
]
517-
if section in optional_sections:
518-
log.debug('Section {section} Option {option} '
519-
'does not exist in the config!'.format(section=section,
520-
option=option))
531+
no_section_msg = (
532+
'Section {section} Option {option} '
533+
'does not exist in the config!'
534+
).format(section=section, option=option)
535+
536+
if section in OPTIONAL_AIRFLOW_CFG_SECTIONS:
537+
log.debug(no_section_msg)
521538
else:
522-
log.error('Section {section} Option {option} '
523-
'does not exist in the config!'.format(section=section,
524-
option=option))
539+
log.error(no_section_msg)
525540

526541
settings.configure_vars()
527542

0 commit comments

Comments
 (0)