fix: remove some unreachable situations
This commit is contained in:
parent
eb024311ea
commit
73153c980e
1 changed files with 12 additions and 11 deletions
|
@ -55,9 +55,9 @@ class Parser:
|
||||||
|
|
||||||
service_extends: Optional[Extends] = None
|
service_extends: Optional[Extends] = None
|
||||||
if service_data.extends is not None:
|
if service_data.extends is not None:
|
||||||
if type(service_data.extends) is str:
|
# https://github.com/compose-spec/compose-spec/blob/master/spec.md#extends
|
||||||
service_extends = Extends(service_name=service_data.extends)
|
# The value of the extends key MUST be a dictionary.
|
||||||
elif type(service_data.extends) is spec.Extend:
|
assert type(service_data.extends) is spec.Extend
|
||||||
service_extends = Extends(
|
service_extends = Extends(
|
||||||
service_name=service_data.extends.service, from_file=service_data.extends.file
|
service_name=service_data.extends.service, from_file=service_data.extends.file
|
||||||
)
|
)
|
||||||
|
@ -95,15 +95,14 @@ class Parser:
|
||||||
elif type(port_data) is spec.Port:
|
elif type(port_data) is spec.Port:
|
||||||
assert port_data.target is not None, "Invalid port format, aborting."
|
assert port_data.target is not None, "Invalid port format, aborting."
|
||||||
|
|
||||||
if type(port_data.published) is int:
|
# ruamel.yaml does not parse port as int
|
||||||
host_port = str(port_data.published)
|
assert type(port_data.published) is not int
|
||||||
elif type(port_data.published) is str:
|
|
||||||
|
if type(port_data.published) is str:
|
||||||
host_port = port_data.published
|
host_port = port_data.published
|
||||||
|
|
||||||
if type(port_data.target) is int:
|
if type(port_data.target) is int:
|
||||||
container_port = str(port_data.target)
|
container_port = str(port_data.target)
|
||||||
elif type(port_data.target) is str:
|
|
||||||
container_port = port_data.target
|
|
||||||
|
|
||||||
host_ip = port_data.host_ip
|
host_ip = port_data.host_ip
|
||||||
protocol = port_data.protocol
|
protocol = port_data.protocol
|
||||||
|
@ -158,6 +157,8 @@ class Parser:
|
||||||
elif type(volume_data) is spec.ServiceVolume:
|
elif type(volume_data) is spec.ServiceVolume:
|
||||||
assert volume_data.target is not None, "Invalid volume input, aborting."
|
assert volume_data.target is not None, "Invalid volume input, aborting."
|
||||||
|
|
||||||
|
# https://github.com/compose-spec/compose-spec/blob/master/spec.md#long-syntax-4
|
||||||
|
# `volume_data.source` is not applicable for a tmpfs mount.
|
||||||
if volume_data.source is None:
|
if volume_data.source is None:
|
||||||
volume_data.source = volume_data.target
|
volume_data.source = volume_data.target
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue