File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -16,17 +16,17 @@ def extract_agent_config(config):
1616 agentConfig = {}
1717
1818 backend = config .get ('Main' , 'service_discovery_backend' )
19- agentConfig ['service_discovery' ] = True
19+ if backend in SD_BACKENDS :
20+ agentConfig ['service_discovery' ] = True
21+ else :
22+ log .error ("The backend {0} is not supported. "
23+ "Service discovery won't be enabled." .format (backend ))
24+ agentConfig ['service_discovery' ] = False
2025
2126 conf_backend = None
2227 if config .has_option ('Main' , 'sd_config_backend' ):
2328 conf_backend = config .get ('Main' , 'sd_config_backend' )
2429
25- if backend not in SD_BACKENDS :
26- log .error ("The backend {0} is not supported. "
27- "Service discovery won't be enabled." .format (backend ))
28- agentConfig ['service_discovery' ] = False
29-
3030 if conf_backend is None :
3131 log .debug ('No configuration backend provided for service discovery. '
3232 'Only auto config templates will be used.' )
Original file line number Diff line number Diff line change @@ -408,10 +408,9 @@ def get_configs(self):
408408 else :
409409 configs [check_name ] = (source , (init_config , [instance ]))
410410 else :
411- conflict_init_msg = 'Different versions of `init_config` found for check {}. ' \
412- 'Keeping the first one found.'
413411 if configs [check_name ][1 ][0 ] != init_config :
414- log .warning (conflict_init_msg .format (check_name ))
412+ log .warning ('Different versions of `init_config` found for check %s. '
413+ 'Keeping the first one found.' % check_name )
415414 if isinstance (instance , list ):
416415 for inst in instance :
417416 configs [check_name ][1 ][1 ].append (inst )
You can’t perform that action at this time.
0 commit comments