From d1da454da6b69c2fec891ef855d26f9a1be1d444 Mon Sep 17 00:00:00 2001 From: Stephen Paul Suarez Date: Tue, 27 May 2014 11:20:15 +0800 Subject: [PATCH 1/3] support rw bind mode in docker module --- library/cloud/docker | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/cloud/docker b/library/cloud/docker index 509e5eb9559..d6abe69ff3e 100644 --- a/library/cloud/docker +++ b/library/cloud/docker @@ -358,6 +358,13 @@ class DockerManager: if len(parts) == 2: self.volumes[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) else: self.volumes[parts[0]] = {} From 1edcee5ae87017ee7c50e00aba85d8a813bc843a Mon Sep 17 00:00:00 2001 From: Stephen Paul Suarez Date: Tue, 27 May 2014 19:19:49 +0800 Subject: [PATCH 2/3] fix typo --- library/cloud/docker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/cloud/docker b/library/cloud/docker index d6abe69ff3e..ea9fa59037d 100644 --- a/library/cloud/docker +++ b/library/cloud/docker @@ -361,7 +361,7 @@ class DockerManager: # 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"') + self.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} From 2c8564e787f9ad6ef660f313f8134a8a66c50618 Mon Sep 17 00:00:00 2001 From: Stephen Paul Suarez Date: Wed, 28 May 2014 06:14:54 +0800 Subject: [PATCH 3/3] fix spacing --- library/cloud/docker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/cloud/docker b/library/cloud/docker index ea9fa59037d..615f511ff1b 100644 --- a/library/cloud/docker +++ b/library/cloud/docker @@ -361,7 +361,7 @@ class DockerManager: # with bind mode elif len(parts) == 3: if parts[2] not in ['ro', 'rw']: - self.module.fail_json(msg='bind mode needs to either be "ro" or "rw"') + self.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}