Merge pull request #1007 from coreos-inc/acivolumes

Fix ACI volumes
This commit is contained in:
josephschorr 2015-12-01 15:05:58 -05:00
commit 8afb4691a5

View file

@ -84,7 +84,7 @@ class ACIImage(TarImageFormatter):
""" Builds the ports definitions for the ACI. """ """ Builds the ports definitions for the ACI. """
ports = [] ports = []
for docker_port_definition in docker_config.get('ports', {}): for docker_port_definition in docker_config.get('ports', docker_config.get('Ports', {})):
# Formats: # Formats:
# port/tcp # port/tcp
# port/udp # port/udp
@ -117,20 +117,12 @@ class ACIImage(TarImageFormatter):
names = set() names = set()
def get_name(docker_volume_path): def get_name(docker_volume_path):
parts = docker_volume_path.split('/') return "volume-%s" % docker_volume_path.replace('/', '-')
name = ''
while True: for docker_volume_path in docker_config.get('volumes', docker_config.get('Volumes', {})):
name = name + parts[-1] if not docker_volume_path:
parts = parts[0:-1] continue
if names.add(name):
break
name = '/' + name
return name.lower()
for docker_volume_path in docker_config.get('volumes', {}):
volumes.append({ volumes.append({
"name": get_name(docker_volume_path), "name": get_name(docker_volume_path),
"path": docker_volume_path, "path": docker_volume_path,