Fix for 'cannot unmarshal array into Go value of type string' error about HostConfig Binds (#3496)

reviewable/pr18780/r1
Darek Kaczyński 9 years ago committed by Brian Coca
parent 7fb0605824
commit f7c32e2b5e

@ -713,7 +713,7 @@ class DockerManager(object):
self.module.fail_json(msg='invalid bind mode ' + parts[2]) self.module.fail_json(msg='invalid bind mode ' + parts[2])
else: else:
mode = parts[2] mode = parts[2]
self.binds.append((parts[0], {'bind': parts[1], 'mode': mode})) self.binds.append("%s:%s:%s" % (parts[0], parts[1], mode))
else: else:
self.module.fail_json(msg='volumes support 1 to 3 arguments') self.module.fail_json(msg='volumes support 1 to 3 arguments')
@ -1366,14 +1366,8 @@ class DockerManager(object):
expected_binds = set() expected_binds = set()
if self.binds: if self.binds:
for host_path, config in self.binds: for bind in self.binds:
if isinstance(config, dict): expected_binds.add(bind)
container_path = config['bind']
mode = config['mode']
else:
container_path = config
mode = 'rw'
expected_binds.add("{0}:{1}:{2}".format(host_path, container_path, mode))
actual_binds = set() actual_binds = set()
for bind in (container['HostConfig']['Binds'] or []): for bind in (container['HostConfig']['Binds'] or []):

Loading…
Cancel
Save