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

This commit is contained in:
Darek Kaczyński 2016-04-23 03:05:16 +02:00 committed by Matt Clay
parent 1985115e55
commit 08ad68984c

View file

@ -717,7 +717,7 @@ class DockerManager(object):
self.module.fail_json(msg='invalid bind mode ' + parts[2])
else:
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:
self.module.fail_json(msg='volumes support 1 to 3 arguments')
@ -1370,14 +1370,8 @@ class DockerManager(object):
expected_binds = set()
if self.binds:
for host_path, config in self.binds:
if isinstance(config, dict):
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))
for bind in self.binds:
expected_binds.add(bind)
actual_binds = set()
for bind in (container['HostConfig']['Binds'] or []):