update manage.py

This commit is contained in:
TooY 2023-03-31 18:26:50 +08:00
parent f9972a9abb
commit a55511b016

View file

@ -176,26 +176,24 @@ def uninstall_app(app_id):
ret = Response(code=const.RETURN_FAIL, message="")
if docker.check_app_id(app_id):
app_name = split_app_id(app_id)
info, code = if_app_exits(app_id)
if code:
app_path = info.split()[-1].rsplit('/', 1)[0]
if_stopped = stop_app(app_id) # stop_app
app_name = split_app_id(app_id)
if if_stopped["code"] == 0:
cmd = "docker compose -f " + app_path + "/docker-compose.yml down -v"
lib_path = '/data/library/apps/' + app_name
if app_path != lib_path:
cmd = cmd + " && sudo rm -rf " + app_path
output = shell_execute.execute_command_output_all(cmd)
if int(output["code"]) == 0:
ret.code = 0
ret.message = "The app is deleted successfully"
else:
ret.message = "App deletion failed!"
app_path = info.split()[-1].rsplit('/', 1)[0]
if_stopped = stop_app(app_id) # stop_app
app_name = split_app_id(app_id)
if if_stopped["code"] == 0:
cmd = "docker compose -f " + app_path + "/docker-compose.yml down -v"
lib_path = '/data/library/apps/' + app_name
if app_path != lib_path:
cmd = cmd + " && sudo rm -rf " + app_path
output = shell_execute.execute_command_output_all(cmd)
if int(output["code"]) == 0:
ret.code = 0
ret.message = "The app is deleted successfully"
else:
ret.message = if_stopped["message"]
ret.message = "App deletion failed!"
else:
ret.message = 'AppID is not legal!'
ret.message = if_stopped["message"]
else:
ret.message = 'AppID is not legal!'
ret = ret.dict()
return ret