fix: fix parse yaml test implement
This commit is contained in:
parent
d53d0a77cf
commit
b86a1f7fe3
1 changed files with 5 additions and 2 deletions
|
@ -13,7 +13,7 @@ class Parser:
|
|||
# load the yaml file
|
||||
with open(file_path, "r") as f:
|
||||
try:
|
||||
yaml = YAML()
|
||||
yaml = YAML(typ='safe', pure=True)
|
||||
yaml_data = yaml.load(f)
|
||||
except YAML.YAMLError as exc:
|
||||
raise YAML.YAMLError
|
||||
|
@ -33,7 +33,10 @@ class Parser:
|
|||
service_image = service["image"]
|
||||
#print("image: {}".format(service_image))
|
||||
if service.get("networks"):
|
||||
service_networks = service["networks"]
|
||||
if(type(service["networks"]) is list):
|
||||
service_networks = service["networks"]
|
||||
else:
|
||||
service_networks = list(service["networks"].keys())
|
||||
#print("networks: {}".format(service_networks))
|
||||
services.append(Service(
|
||||
name=service_name,
|
||||
|
|
Loading…
Reference in a new issue