def reset_server(self, user_manage_id): if not (current_user.get_id() == repository_user.get_id()): return jsonify({"success": False, "message": "not authorized", "alert_type": "alert-warning"}) try: self.show_um_message("removing all containers", user_manage_id) do_docker_cleanup() self.show_um_message("recreating the megaplex", user_manage_id) create_megaplex() self.show_um_message("initializing the global tile manager", user_manage_id) global_tile_manager.initialize() self.show_um_message("getting default tiles", user_manage_id) global_tile_manager.get_all_default_tiles() except Exception as ex: template = "<pre>An exception of type {0} occured. Arguments:\n{1!r}</pre>" error_string = template.format(type(ex).__name__, ex.args) error_string += traceback.format_exc() return jsonify({"success": False, "message": error_string, "alert_type": "alert-warning"}) self.clear_um_message(user_manage_id) self.update_selector_list() return jsonify({"success": True, "message": "Server successefully reset", "alert_type": "alert-success"})
# The unused imports here are required so that the # various handlers are registered via decorators # Much of the setup is done in tactic_app/__init__.py # This avoids circular imports since the view functions make use # of things such as app, socketio, and db that are created in __init__.py import docker_cleanup print "entering tactic_run" docker_cleanup.do_docker_cleanup() from tactic_app import app, socketio from tactic_app import host_workers from tactic_app import users from views import auth_views, main_views, user_manage_views, admin_views, creator_views from tactic_app.global_tile_management import global_tile_manager global_tile_manager.get_all_default_tiles()