From 11329e779bb986709add9eabfa90f28920a322ec Mon Sep 17 00:00:00 2001 From: stefan Date: Thu, 30 Jun 2016 14:07:57 +0200 Subject: [PATCH 1/2] added failing test that ensures that named volume will not be printed with a mode suffix Signed-off-by: stefan --- tests/acceptance/cli_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 tests/acceptance/cli_test.py diff --git a/tests/acceptance/cli_test.py b/tests/acceptance/cli_test.py old mode 100644 new mode 100755 index cc7bc5dfe..7cc5adb92 --- a/tests/acceptance/cli_test.py +++ b/tests/acceptance/cli_test.py @@ -222,7 +222,7 @@ class CLITestCase(DockerClientTestCase): 'other': { 'image': 'busybox:latest', 'command': 'top', - 'volumes': ['/data:rw'], + 'volumes': ['/data'], }, }, } From 83728d2bcc3b56648ee53b177e1ad1ad1d586e17 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Thu, 2 Mar 2017 15:27:04 -0800 Subject: [PATCH 2/2] Do not add mode in volume representation if it's not a host binding Signed-off-by: Joffrey F --- compose/config/types.py | 3 ++- tests/acceptance/cli_test.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) mode change 100755 => 100644 tests/acceptance/cli_test.py diff --git a/compose/config/types.py b/compose/config/types.py index 811e6c1fc..f4d2c26d9 100644 --- a/compose/config/types.py +++ b/compose/config/types.py @@ -203,7 +203,8 @@ class VolumeSpec(namedtuple('_VolumeSpec', 'external internal mode')): def repr(self): external = self.external + ':' if self.external else '' - return '{ext}{v.internal}:{v.mode}'.format(ext=external, v=self) + mode = ':' + self.mode if self.external else '' + return '{ext}{v.internal}{mode}'.format(mode=mode, ext=external, v=self) @property def is_named_volume(self): diff --git a/tests/acceptance/cli_test.py b/tests/acceptance/cli_test.py old mode 100755 new mode 100644 index 7cc5adb92..115dc6439 --- a/tests/acceptance/cli_test.py +++ b/tests/acceptance/cli_test.py @@ -299,7 +299,7 @@ class CLITestCase(DockerClientTestCase): }, 'volume': { 'image': 'busybox', - 'volumes': ['/data:rw'], + 'volumes': ['/data'], 'network_mode': 'bridge', }, 'app': {