is_named_volume also tests for home paths ~
Fix bug with VolumeSpec not being updated Fix integration test Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
a66bf72199
commit
3da25aa463
3 changed files with 10 additions and 8 deletions
|
|
@ -166,6 +166,4 @@ class VolumeSpec(namedtuple('_VolumeSpec', 'external internal mode')):
|
|||
|
||||
@property
|
||||
def is_named_volume(self):
|
||||
return self.external and not (
|
||||
self.external.startswith('.') or self.external.startswith('/')
|
||||
)
|
||||
return self.external and not self.external.startswith(('.', '/', '~'))
|
||||
|
|
|
|||
|
|
@ -477,7 +477,8 @@ def get_networks(service_dict, network_definitions):
|
|||
|
||||
|
||||
def match_named_volumes(service_dict, project_volumes):
|
||||
for volume_spec in service_dict.get('volumes', []):
|
||||
service_volumes = service_dict.get('volumes', [])
|
||||
for volume_spec in service_volumes:
|
||||
if volume_spec.is_named_volume:
|
||||
declared_volume = next(
|
||||
(v for v in project_volumes if v.name == volume_spec.external),
|
||||
|
|
@ -490,7 +491,9 @@ def match_named_volumes(service_dict, project_volumes):
|
|||
volume_spec.repr(), service_dict.get('name')
|
||||
)
|
||||
)
|
||||
volume_spec._replace(external=declared_volume.full_name)
|
||||
service_volumes[service_volumes.index(volume_spec)] = (
|
||||
volume_spec._replace(external=declared_volume.full_name)
|
||||
)
|
||||
|
||||
|
||||
def get_volumes_from(project, service_dict):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue