Sync up with allowable docker volume mounting modes

This commit is contained in:
Steve Spencer 2015-11-12 10:42:26 +02:00 committed by Matt Clay
parent 769d7db1d0
commit d4aca8eacc

View file

@ -80,8 +80,10 @@ options:
version_added: "1.5" version_added: "1.5"
volumes: volumes:
description: description:
- List of volumes to mount within the container using docker CLI-style - List of volumes to mount within the container
- 'syntax: C(/host:/container[:mode]) where "mode" may be "rw", "ro", "Z", "z".' - 'Use docker CLI-style syntax: C(/host:/container[:mode])'
- You can specify a read mode for the mount with either C(ro) or C(rw). SELinux hosts can additionally
use C(z) or C(Z) mount options to use a shared or private label for the volume.
default: null default: null
volumes_from: volumes_from:
description: description:
@ -640,8 +642,8 @@ class DockerManager(object):
mode = 'rw' mode = 'rw'
# with supplied bind mode # with supplied bind mode
if len(parts) == 3: if len(parts) == 3:
if parts[2] not in ['ro', 'rw', 'z', 'Z']: if parts[2] not in ["rw", "rw,Z", "rw,z", "z,rw", "Z,rw", "Z", "z", "ro", "ro,Z", "ro,z", "z,ro", "Z,ro"]:
self.module.fail_json(msg='bind mode needs to be one of "ro", "rw", "z", or "Z"') self.module.fail_json(msg='invalid bind mode ' + parts[2])
else: else:
mode = parts[2] mode = parts[2]
self.binds[parts[0]] = {'bind': parts[1], 'mode': mode } self.binds[parts[0]] = {'bind': parts[1], 'mode': mode }