From 747dd06be1454d2bc757e730a4e470a44b10d28d Mon Sep 17 00:00:00 2001 From: uccuz Date: Fri, 3 Jun 2022 16:57:58 +0800 Subject: [PATCH] feat: implement new test case --- compose_viz/parser.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/compose_viz/parser.py b/compose_viz/parser.py index 63139d4..4d631fc 100644 --- a/compose_viz/parser.py +++ b/compose_viz/parser.py @@ -176,6 +176,35 @@ class Parser: if service_data.links is not None: service_links = service_data.links + + cgroup_parent: Optional[str] = None + if service_data.cgroup_parent is not None: + cgroup_parent = service_data.cgroup_parent + + container_name: Optional[str] = None + if service_data.container_name is not None: + container_name = service_data.container_name + + + env_file: List[str] = [] + if service_data.env_file is not None: + if type(service_data.env_file) is spec.StringOrList: + if(type(service_data.env_file.__root__) is spec.ListOfStrings): + env_file = service_data.env_file.__root__.__root__ + elif(type(service_data.env_file.__root__) is str): + env_file.append(service_data.env_file.__root__) + + + expose: List[str] = [] + if service_data.expose is not None: + expose = service_data.expose + + profiles: List[str] = [] + if service_data.profiles is not None: + if type(service_data.profiles) is spec.ListOfStrings: + profiles = service_data.profiles.__root__ + + services.append( Service( name=service_name, @@ -186,6 +215,11 @@ class Parser: depends_on=service_depends_on, volumes=service_volumes, links=service_links, + cgroup_parent=cgroup_parent, + container_name=container_name, + env_file=env_file, + expose=expose, + profiles=profiles, ) )