Print a more informative error message on misconfigured volumes
When making a mistake in the volumes configuration the error message thrown to the operator is something like the following: Traceback (most recent call last): File \"/var/lib/docker-puppet/docker-puppet.py\", line 394, in <module> config_volumes = match_config_volumes(config_volume_prefix, v) File \"/var/lib/docker-puppet/docker-puppet.py\", line 89, in match_config_volumes volumes = config.get('volumes', []) AttributeError: 'list' object has no attribute 'get' Let's at least log *which* container had the failure. Change-Id: I37af67a52f12d8a5d643b03c6796a07b23d47ab5
This commit is contained in:
parent
e09ef3df9d
commit
e42198368f
@ -96,7 +96,11 @@ def pull_image(name):
|
||||
def match_config_volumes(prefix, config):
|
||||
# Match the mounted config volumes - we can't just use the
|
||||
# key as e.g "novacomute" consumes config-data/nova
|
||||
volumes = config.get('volumes', [])
|
||||
try:
|
||||
volumes = config.get('volumes', [])
|
||||
except AttributeError:
|
||||
log.error('Error fetching volumes. Prefix: %s - Config: %s' % (prefix, config))
|
||||
raise
|
||||
return sorted([os.path.dirname(v.split(":")[0]) for v in volumes if
|
||||
v.startswith(prefix)])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user