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

More small fixes.

- Update the prospector pre-commit hook, it was failing for some reason.
- Address some docstring issues it started complaining about.
parent 91fc3057
No related branches found
No related tags found
No related merge requests found
Pipeline #2695 passed
......@@ -90,7 +90,7 @@ repos:
--line-length=79
- repo: https://github.com/PyCQA/prospector.git
rev: 1.5.1
rev: 1.7.1
hooks:
- id: prospector
args:
......
......@@ -13,9 +13,13 @@ import dotenv # pylint: disable=import-error
def get_project_containers_health(client, project):
"""Get a Docker connection and the Docker Compose project name and return a
# noqa: D213
"""Get the health of containers of a Compose project.
Get a Docker connection and the Docker Compose project name and return a
dictionary of container objects and their health status (if available, else
their status)."""
their status).
"""
return {
i: i.attrs["State"]["Health"]["Status"]
if "Health" in i.attrs["State"]
......@@ -27,13 +31,18 @@ def get_project_containers_health(client, project):
def get_unhealthy_project_containers(client, project):
"""Returns a list (could be empty) of containers that are not healthy or
not running (in case a health check is not set)."""
# noqa: D213
"""Returns a list (could be empty) of containers that are not healthy.
Or in the case that a health check is not set, containers that are not
running.
"""
healths = get_project_containers_health(client, project)
return [x for x in healths if healths[x] not in ["healthy", "running"]]
def wait_for_project_health(project, timeout):
# noqa: D213
"""Wait for a Docker Compose project to be healthy.
If all of the containers are healthy or running (because there's no
......@@ -79,7 +88,6 @@ def get_project_name(args):
def main():
"""Main entrypoint."""
epilog = (
"The Docker Compose project name is resolved in the following order:"
"\n1. From the command line parameter."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment