Skip to content
Snippets Groups Projects
Commit bb81c056 authored by nimrod's avatar nimrod
Browse files

Handle missing Compose projects.

parent 080a6307
No related branches found
No related tags found
No related merge requests found
Pipeline #2398 passed
...@@ -49,6 +49,8 @@ def wait_for_project_health(project, timeout): ...@@ -49,6 +49,8 @@ def wait_for_project_health(project, timeout):
docker_client.ping() docker_client.ping()
while True: while True:
healths = get_project_containers_health(docker_client, project) healths = get_project_containers_health(docker_client, project)
if not healths:
raise RuntimeError(f"No containers found for project {project}.")
# pylint: disable=no-else-return # pylint: disable=no-else-return
if not get_unhealthy_project_containers(docker_client, project): if not get_unhealthy_project_containers(docker_client, project):
return [] return []
...@@ -107,7 +109,10 @@ def main(): ...@@ -107,7 +109,10 @@ def main():
"Compose project wasn't specified, the COMPOSE_PROJECT_NAME variable is missing from the environment and from the .env file." # noqa: E501 "Compose project wasn't specified, the COMPOSE_PROJECT_NAME variable is missing from the environment and from the .env file." # noqa: E501
) )
try:
unhealthy = wait_for_project_health(project, args.timeout) unhealthy = wait_for_project_health(project, args.timeout)
except Exception as e: # pylint: disable=broad-except
arg_parser.error(str(e))
if not unhealthy: if not unhealthy:
print(f"Project {project} is healthy.") print(f"Project {project} is healthy.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment