File tree Expand file tree Collapse file tree 2 files changed +27
-23
lines changed
Expand file tree Collapse file tree 2 files changed +27
-23
lines changed Original file line number Diff line number Diff line change @@ -754,6 +754,25 @@ def restart_application(short_name):
754754 except Exception as e :
755755 return False
756756
757+ def backup_data_folder (app_data ):
758+ log_message (" Running backup_data_folder..." )
759+ # app_folder = app_data["install_folder"]
760+ # data_folder = app_data["storage_folder"]
761+ #
762+ # # Clear old data (not storage)
763+ # if os.path.isdir(app_folder):
764+ # log_message(" App folder exists, deleting...")
765+ # run_linux_cmd("rm -rf {}".format(app_folder))
766+ #
767+ # log_message(" Making application folders...")
768+ # run_linux_cmd("mkdir {}".format(app_folder))
769+ # run_linux_cmd("mkdir -p {}".format(data_folder))
770+ #
771+ # # Set folder permissions (always set for now - could check to see if already proper user)
772+ # log_message(" Updating folder permissions...")
773+ # run_linux_cmd("chown -R {}:{} {}".format(app_data["linux_user"], app_data["linux_user"], app_folder))
774+ # run_linux_cmd("chown -R {}:{} {}".format(app_data["linux_user"], app_data["linux_user"], data_folder))
775+
757776def reset_data_folder (app_data ):
758777 log_message (" Running reset_data_folder..." )
759778
Original file line number Diff line number Diff line change @@ -149,32 +149,17 @@ def api_restart_app():
149149
150150 return "OK"
151151
152- # @mynode_api.route("/api/restart_app")
153152@mynode_api .route ("/api/backup_data_folder" )
154153def api_backup_data_folder ():
155- # check_logged_in()
156- #
157- # app = request.args.get("app")
158- # if not app:
159- # return "NO_APP_SPECIFIED"
160- # if not is_application_valid(app):
161- # return "INVALID_APP_NAME"
162- # if not restart_application(app):
163- # return "ERROR"
164- return "OK"
154+ check_logged_in ()
165155
166- # @mynode_api.route("/api/restart_app")
167- @mynode_api .route ("/api/restore_data_folder" )
168- def api_restore_data_folder ():
169- # check_logged_in()
170- #
171- # app = request.args.get("app")
172- # if not app:
173- # return "NO_APP_SPECIFIED"
174- # if not is_application_valid(app):
175- # return "INVALID_APP_NAME"
176- # if not restart_application(app):
177- # return "ERROR"
156+ app = request .args .get ("app" )
157+ if not app :
158+ return "NO_APP_SPECIFIED"
159+ if not is_application_valid (app ):
160+ return "INVALID_APP_NAME"
161+ if not backup_data_folder (app ):
162+ return "ERROR"
178163 return "OK"
179164
180165@mynode_api .route ("/api/reset_data_folder" )
You can’t perform that action at this time.
0 commit comments