From f9a295547c847cd3e8a77b13a2ca7e8163bfc6b9 Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Sat, 20 May 2023 14:56:24 +0800 Subject: [PATCH] erpnext status show exited bug --- appmanage/Dockerfile | 2 +- appmanage/api/service/manage.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/appmanage/Dockerfile b/appmanage/Dockerfile index ef28a3a5..d6cf741e 100644 --- a/appmanage/Dockerfile +++ b/appmanage/Dockerfile @@ -10,7 +10,7 @@ COPY static ./static COPY requirements.txt main.py ./ RUN apt update -# Install supervisord +# Install supervisords RUN apt install -y supervisor COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY config/cmd.sh /cmd.sh diff --git a/appmanage/api/service/manage.py b/appmanage/api/service/manage.py index 836ba069..6e5efeef 100644 --- a/appmanage/api/service/manage.py +++ b/appmanage/api/service/manage.py @@ -326,17 +326,17 @@ def get_apps_from_compose(): default_domain = "" if customer_name in ['w9appmanage', 'w9nginxproxymanager','w9redis','w9portainer'] and app_path == '/data/apps/stackhub/docker/' + customer_name: continue - + + status_show = app_info["Status"] status = app_info["Status"].split("(")[0] if status == "running" or status == "exited" or status == "restarting": - myLogger.info_logger("ok") - if status == "exited": - - cmd = "docker ps -a -f name=" + customer_name + " --format {{.Names}}#{{.Status}}|grep Exited" - result = shell_execute.execute_command_output_all(cmd)["result"].rstrip('\n') - container = result.split("#Exited")[0] - if container != customer_name: - status = "running" + if "exited" in status_show and "running" in status_show: + if status == "exited": + cmd = "docker ps -a -f name=" + customer_name + " --format {{.Names}}#{{.Status}}|grep Exited" + result = shell_execute.execute_command_output_all(cmd)["result"].rstrip('\n') + container = result.split("#Exited")[0] + if container != customer_name: + status = "running" elif status == "created": status = "failed" else: