app manage: update

This commit is contained in:
TooY 2023-03-16 10:03:54 +08:00
parent 3c28c8e6a2
commit 7d6f3656b0
3 changed files with 5 additions and 3 deletions

View file

@ -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

View file

@ -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'

View file

@ -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):