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
|
# load the yaml file
|
||||||
with open(file_path, "r") as f:
|
with open(file_path, "r") as f:
|
||||||
try:
|
try:
|
||||||
yaml = YAML()
|
yaml = YAML(typ='safe', pure=True)
|
||||||
yaml_data = yaml.load(f)
|
yaml_data = yaml.load(f)
|
||||||
except YAML.YAMLError as exc:
|
except YAML.YAMLError as exc:
|
||||||
raise YAML.YAMLError
|
raise YAML.YAMLError
|
||||||
|
@ -33,7 +33,10 @@ class Parser:
|
||||||
service_image = service["image"]
|
service_image = service["image"]
|
||||||
#print("image: {}".format(service_image))
|
#print("image: {}".format(service_image))
|
||||||
if service.get("networks"):
|
if service.get("networks"):
|
||||||
|
if(type(service["networks"]) is list):
|
||||||
service_networks = service["networks"]
|
service_networks = service["networks"]
|
||||||
|
else:
|
||||||
|
service_networks = list(service["networks"].keys())
|
||||||
#print("networks: {}".format(service_networks))
|
#print("networks: {}".format(service_networks))
|
||||||
services.append(Service(
|
services.append(Service(
|
||||||
name=service_name,
|
name=service_name,
|
||||||
|
|
Loading…
Reference in a new issue