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

pull/18777/head
Darek Kaczyński 9 years ago committed by Matt Clay
parent 1985115e55
commit 08ad68984c

@ -717,7 +717,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')
@ -1370,14 +1370,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