Skip to content

Commit

Permalink
Minor touchups for code clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew committed Oct 27, 2020
1 parent 154e56b commit fd82329
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
12 changes: 6 additions & 6 deletions utils/service_discovery/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ def extract_agent_config(config):
agentConfig = {}

backend = config.get('Main', 'service_discovery_backend')
agentConfig['service_discovery'] = True
if backend in SD_BACKENDS:
agentConfig['service_discovery'] = True
else
log.error("The backend {0} is not supported. "
"Service discovery won't be enabled.".format(backend))
agentConfig['service_discovery'] = False

conf_backend = None
if config.has_option('Main', 'sd_config_backend'):
conf_backend = config.get('Main', 'sd_config_backend')

if backend not in SD_BACKENDS:
log.error("The backend {0} is not supported. "
"Service discovery won't be enabled.".format(backend))
agentConfig['service_discovery'] = False

if conf_backend is None:
log.debug('No configuration backend provided for service discovery. '
'Only auto config templates will be used.')
Expand Down
5 changes: 2 additions & 3 deletions utils/service_discovery/sd_docker_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,9 @@ def get_configs(self):
else:
configs[check_name] = (source, (init_config, [instance]))
else:
conflict_init_msg = 'Different versions of `init_config` found for check {}. ' \
'Keeping the first one found.'
if configs[check_name][1][0] != init_config:
log.warning(conflict_init_msg.format(check_name))
log.warning('Different versions of `init_config` found for check %s. '
'Keeping the first one found.' % check_name)
if isinstance(instance, list):
for inst in instance:
configs[check_name][1][1].append(inst)
Expand Down

0 comments on commit fd82329

Please sign in to comment.