Merge "Enable docker-puppet.py for a single config_volume"

This commit is contained in:
Zuul 2018-01-13 06:40:48 +00:00 committed by Gerrit Code Review
commit 5334c679f0
2 changed files with 18 additions and 2 deletions

View File

@ -131,6 +131,8 @@ process_count = int(os.environ.get('PROCESS_COUNT',
log = get_logger()
log.info('Running docker-puppet')
config_file = os.environ.get('CONFIG', '/var/lib/docker-puppet/docker-puppet.json')
# If specified, only this config_volume will be used
config_volume_only = os.environ.get('CONFIG_VOLUME', None)
log.debug('CONFIG: %s' % config_file)
with open(config_file) as f:
json_data = json.load(f)
@ -187,8 +189,12 @@ for service in (json_data or []):
log.warn("Config containers do not match even though"
" shared volumes are the same!")
else:
log.debug("Adding new service")
configs[config_volume] = service
if not config_volume_only or (config_volume_only == config_volume):
log.debug("Adding new service")
configs[config_volume] = service
else:
log.debug("Ignoring %s due to $CONFIG_VOLUME=%s" %
(config_volume, config_volume_only))
log.info('Service compilation completed.')

View File

@ -0,0 +1,10 @@
---
fixes:
- If docker-puppet.py fails on any config_volume, it can be difficult to
reproduce the failure given all the other entries in docker-puppet.json.
Often to reproduce a single failure, one has to modify the json file, and
remove all other entries, save the result to a new file, then pass that new
file as $CONFIG. The ability to specify $CONFIG_VOLUME, which will cause
docker-puppet.py to only run the configuration for the specified entry in
docker-puppet.json whose config_volume value matches the user specified
value has been added.