support rw bind mode in docker module

This commit is contained in:
Stephen Paul Suarez 2014-05-27 11:20:15 +08:00
parent 92de7d712d
commit 6b84f7093f

View file

@ -358,6 +358,13 @@ class DockerManager:
if len(parts) == 2: if len(parts) == 2:
self.volumes[parts[1]] = {} self.volumes[parts[1]] = {}
self.binds[parts[0]] = parts[1] self.binds[parts[0]] = parts[1]
# with bind mode
elif len(parts) == 3:
if parts[2] not in ['ro', 'rw']:
module.fail_json(msg='bind mode needs to either be "ro" or "rw"')
ro = parts[2] == 'ro'
self.volumes[parts[1]] = {}
self.binds[parts[0]] = {'bind': parts[1], 'ro': ro}
# docker mount (e.g. /www, mounts a docker volume /www on the container at the same location) # docker mount (e.g. /www, mounts a docker volume /www on the container at the same location)
else: else:
self.volumes[parts[0]] = {} self.volumes[parts[0]] = {}