still testing²
This commit is contained in:
58
main.py
58
main.py
@@ -129,36 +129,36 @@ def yaml_file_to_container_list(filepath: str) -> list|None:
|
||||
:param filepath: str
|
||||
:return: dict|None
|
||||
'''
|
||||
pass
|
||||
|
||||
|
||||
dependances = []
|
||||
if "depends_on" in ycontent["services"][servicename]:
|
||||
dependances = ycontent["services"][servicename]["depends_on"]
|
||||
|
||||
bindslist = []
|
||||
volumeslist = []
|
||||
for mount in ycontent["services"][servicename]["volumes"]:
|
||||
localpart = mount.split(":")
|
||||
# TODO: adapter avec pathlib pour gérer Windows
|
||||
# si un /, signifie qu'il s'agit d'un chemin et donc d'un bind mount, pas volume.
|
||||
if localpart.find("/") != -1:
|
||||
bindslist.append(localpart)
|
||||
else:
|
||||
volumeslist.append(localpart)
|
||||
|
||||
containersid = os.popen(f"docker-compose --file {filepath} ps --quiet {servicename}").readlines()
|
||||
containersnames = os.popen(f"docker-compose --file {filepath} ps {servicename} | tail -n +3").readlines()
|
||||
|
||||
containerslist = []
|
||||
for i in range(0, len(containersid)):
|
||||
containerslist.append((containersnames[i], containersid[i]))
|
||||
|
||||
for containerfound in containerslist:
|
||||
container = {"service": servicename,
|
||||
"name": containerfound[0],
|
||||
"id": containerfound[1],
|
||||
"binds": bindslist,
|
||||
"depends_on": dependances}
|
||||
# dependances = []
|
||||
# if "depends_on" in ycontent["services"][servicename]:
|
||||
# dependances = ycontent["services"][servicename]["depends_on"]
|
||||
#
|
||||
# bindslist = []
|
||||
# volumeslist = []
|
||||
# for mount in ycontent["services"][servicename]["volumes"]:
|
||||
# localpart = mount.split(":")
|
||||
# # TODO: adapter avec pathlib pour gérer Windows
|
||||
# # si un /, signifie qu'il s'agit d'un chemin et donc d'un bind mount, pas volume.
|
||||
# if localpart.find("/") != -1:
|
||||
# bindslist.append(localpart)
|
||||
# else:
|
||||
# volumeslist.append(localpart)
|
||||
#
|
||||
# containersid = os.popen(f"docker-compose --file {filepath} ps --quiet {servicename}").readlines()
|
||||
# containersnames = os.popen(f"docker-compose --file {filepath} ps {servicename} | tail -n +3").readlines()
|
||||
#
|
||||
# containerslist = []
|
||||
# for i in range(0, len(containersid)):
|
||||
# containerslist.append((containersnames[i], containersid[i]))
|
||||
#
|
||||
# for containerfound in containerslist:
|
||||
# container = {"service": servicename,
|
||||
# "name": containerfound[0],
|
||||
# "id": containerfound[1],
|
||||
# "binds": bindslist,
|
||||
# "depends_on": dependances}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user