Fix volume merging when there's no explicit host path

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2015-03-23 11:40:44 -07:00
commit 35c6e0314c
2 changed files with 50 additions and 23 deletions

View file

@ -324,15 +324,24 @@ def dict_from_volumes(volumes):
return {}
def split_volume(volume):
if ':' in volume:
return reversed(volume.split(':', 1))
else:
return (volume, None)
def volumes_from_dict(d):
return ["%s:%s" % (host_path, container_path) for (container_path, host_path) in d.items()]
return [join_volume(v) for v in d.items()]
def split_volume(string):
if ':' in string:
(host, container) = string.split(':', 1)
return (container, host)
else:
return (string, None)
def join_volume(pair):
(container, host) = pair
if host is None:
return container
else:
return ":".join((host, container))
def expand_path(working_dir, path):