@@ -488,6 +488,24 @@ def _run(args, dag, ti):
488
488
489
489
@cli_utils .action_logging
490
490
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
+
491
509
if dag :
492
510
args .dag_id = dag .dag_id
493
511
@@ -510,18 +528,15 @@ def run(args, dag=None):
510
528
try :
511
529
conf .set (section , option , value )
512
530
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 )
521
538
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 )
525
540
526
541
settings .configure_vars ()
527
542
0 commit comments