parent
5ac7369bf5
commit
e3807c39b3
1 changed files with 18 additions and 2 deletions
|
@ -79,12 +79,28 @@ class ACIImage(TarImageFormatter):
|
|||
|
||||
return isolators
|
||||
|
||||
|
||||
@staticmethod
|
||||
def _get_docker_config_value(docker_config, key, default_value):
|
||||
# Try the key itself.
|
||||
result = docker_config.get(key)
|
||||
if result is not None:
|
||||
return result or default_value
|
||||
|
||||
# The the lowercase version of the key.
|
||||
result = docker_config.get(key.lower())
|
||||
if result is not None:
|
||||
return result or default_value
|
||||
|
||||
return default_value
|
||||
|
||||
|
||||
@staticmethod
|
||||
def _build_ports(docker_config):
|
||||
""" Builds the ports definitions for the ACI. """
|
||||
ports = []
|
||||
|
||||
for docker_port_definition in docker_config.get('ports', docker_config.get('Ports', {})):
|
||||
for docker_port_definition in ACIImage._get_docker_config_value(docker_config, 'Ports', []):
|
||||
# Formats:
|
||||
# port/tcp
|
||||
# port/udp
|
||||
|
@ -119,7 +135,7 @@ class ACIImage(TarImageFormatter):
|
|||
def get_name(docker_volume_path):
|
||||
return "volume-%s" % docker_volume_path.replace('/', '-')
|
||||
|
||||
for docker_volume_path in docker_config.get('volumes', docker_config.get('Volumes', {})):
|
||||
for docker_volume_path in ACIImage._get_docker_config_value(docker_config, 'Volumes', []):
|
||||
if not docker_volume_path:
|
||||
continue
|
||||
|
||||
|
|
Reference in a new issue