in wadebug/wa_actions/implementations/check_containers.py [0:0]
def _run(cls, config, *args, **kwargs):
all_wa_containers = docker_utils.get_wa_containers()
stopped_wa_container_ids = [
wa_container.short_id
for wa_container in all_wa_containers
if not wa_container.is_running()
]
remediation_msg = (
"List all containers on the current host with `docker ps -a` and "
"run `docker start #container_id` to start a container. "
"If a container stops due to errors, "
"refer to messages from other checks to diagnose or contact support "
"https://developers.facebook.com/docs/whatsapp/contact-support"
)
if len(all_wa_containers) == len(stopped_wa_container_ids):
return results.Problem(
cls,
"No WA container is running",
"All WA containers are stopped.",
remediation_msg,
)
if len(stopped_wa_container_ids) > 0:
return results.Warning(
cls,
"Not all WA containers are running.",
f"WA containers with id {', '.join(stopped_wa_container_ids)}"
" not running.",
f"If this is expected, please ignore. {remediation_msg}",
)
return results.OK(cls)