Explorar el Código

Merge pull request #4562 from shin-/lindt-bugfix/unnamed_volumes_do_not_support_mode_suffix

Do not add mode to anonymous volumes in config output
Joffrey F hace 8 años
padre
commit
4dca6adeb1
Se han modificado 2 ficheros con 4 adiciones y 3 borrados
  1. 2 1
      compose/config/types.py
  2. 2 2
      tests/acceptance/cli_test.py

+ 2 - 1
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):

+ 2 - 2
tests/acceptance/cli_test.py

@@ -222,7 +222,7 @@ class CLITestCase(DockerClientTestCase):
                 'other': {
                     'image': 'busybox:latest',
                     'command': 'top',
-                    'volumes': ['/data:rw'],
+                    'volumes': ['/data'],
                 },
             },
         }
@@ -299,7 +299,7 @@ class CLITestCase(DockerClientTestCase):
                 },
                 'volume': {
                     'image': 'busybox',
-                    'volumes': ['/data:rw'],
+                    'volumes': ['/data'],
                     'network_mode': 'bridge',
                 },
                 'app': {