Browse Source

app manage: update

TooY 2 năm trước cách đây
mục cha
commit
7d6f3656b0

+ 3 - 1
appmanage/api/service/manage.py

@@ -278,9 +278,11 @@ def uninstall_app(app_id):
     ret = Response(code=const.RETURN_FAIL, message="")
     if_stopped = stop_app(app_id)
     app_name = split_app_id(app_id)
+    real_name = app_id.split("_")[0]
     if if_stopped["code"] == 0:
         cmd = "docker compose -f /data/apps/"+app_name+"/docker-compose.yml down -v"
-        cmd = cmd + " && sudo rm -rf /data/apps/" + app_name
+        if real_name != app_name:
+            cmd = cmd + " && sudo rm -rf /data/apps/" + app_name
         output = shell_execute.execute_command_output_all(cmd)
         if int(output["code"]) == 0:
             ret.code = 0

+ 1 - 1
appmanage/api/utils/common_log.py

@@ -6,7 +6,7 @@ class MyLogging():
     # init logging
     def __init__(self):
         # the file of log
-        logPath = '/data/apps/appmanage/logs/'
+        logPath = 'logs/'
         if not os.path.exists(logPath):
             os.makedirs(logPath)
         logName = 'app_manage_log.log'

+ 1 - 1
appmanage/api/utils/shell_execute.py

@@ -20,7 +20,7 @@ def execute_command_output_all(cmd_str, max_time = 3):
         else:
             execute_time = execute_time + 1
 
-    myLogger.warning_logger("Command execute failed   Commend: " + cmd_str)
+    myLogger.error_logger("Command execute failed   Commend: " + cmd_str)
     return {"code": "-1", "result": "command execute failed, please check your command!"}
 
 def convert_command(cmd_str):