Move parsing of volumes_from to the last step of config parsing.
Includes creating a new compose.config.types module for all the domain objects. Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
c9ca5e86b0
commit
068edfa313
9 changed files with 74 additions and 45 deletions
|
|
@ -70,6 +70,7 @@ class BuildError(Exception):
|
|||
self.reason = reason
|
||||
|
||||
|
||||
# TODO: remove
|
||||
class ConfigError(ValueError):
|
||||
pass
|
||||
|
||||
|
|
@ -86,9 +87,6 @@ class NoSuchImageError(Exception):
|
|||
VolumeSpec = namedtuple('VolumeSpec', 'external internal mode')
|
||||
|
||||
|
||||
VolumeFromSpec = namedtuple('VolumeFromSpec', 'source mode')
|
||||
|
||||
|
||||
ServiceName = namedtuple('ServiceName', 'project service number')
|
||||
|
||||
|
||||
|
|
@ -1029,21 +1027,6 @@ def build_volume_from(volume_from_spec):
|
|||
return ["{}:{}".format(volume_from_spec.source.id, volume_from_spec.mode)]
|
||||
|
||||
|
||||
def parse_volume_from_spec(volume_from_config):
|
||||
parts = volume_from_config.split(':')
|
||||
if len(parts) > 2:
|
||||
raise ConfigError("Volume %s has incorrect format, should be "
|
||||
"external:internal[:mode]" % volume_from_config)
|
||||
|
||||
if len(parts) == 1:
|
||||
source = parts[0]
|
||||
mode = 'rw'
|
||||
else:
|
||||
source, mode = parts
|
||||
|
||||
return VolumeFromSpec(source, mode)
|
||||
|
||||
|
||||
# Labels
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue