From 73fba6b98092b3d2ca6334bc6fd202cda8885f5f Mon Sep 17 00:00:00 2001 From: Iain Powrie Date: Wed, 24 Nov 2021 01:24:17 +0000 Subject: [PATCH 1/2] Make cryptography a TLD again This is to fix: 'AttributeError: module 'lib' has no attribute 'X509_get_notBefore' --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index aeacca40..3fd218b9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ argon2-cffi~=20.1 bleach~=3.1 colorama~=0.4 +cryptography~=3.4 peewee~=3.13 pexpect~=4.8 psutil~=5.7 From b2dc1521d69d00810262600c4c494b1c509e4460 Mon Sep 17 00:00:00 2001 From: Quentin B Date: Sun, 5 Dec 2021 23:01:44 -0500 Subject: [PATCH 2/2] removed old exit handling logic --- app/classes/shared/cmd.py | 12 ------------ app/classes/shared/helpers.py | 10 ---------- app/classes/shared/server.py | 2 -- app/classes/shared/tasks.py | 12 ------------ main.py | 3 --- 5 files changed, 39 deletions(-) diff --git a/app/classes/shared/cmd.py b/app/classes/shared/cmd.py index dfce718a..d9cd6832 100644 --- a/app/classes/shared/cmd.py +++ b/app/classes/shared/cmd.py @@ -34,17 +34,6 @@ class MainPrompt(cmd.Cmd, object): def emptyline(): pass - @staticmethod - def _clean_shutdown(): - exit_file = os.path.join(helper.root_dir, "exit.txt") - try: - with open(exit_file, 'w') as f: - f.write("exit") - - except Exception as e: - logger.critical("Unable to write exit file due to error: {}".format(e)) - console.critical("Unable to write exit file due to error: {}".format(e)) - def do_exit(self, line): self.universal_exit() @@ -77,7 +66,6 @@ class MainPrompt(cmd.Cmd, object): logger.info("Stopping all server daemons / threads") console.info("Stopping all server daemons / threads - This may take a few seconds") websocket_helper.disconnect_all() - self._clean_shutdown() console.info('Waiting for main thread to stop') while True: if self.tasks_manager.get_main_thread_run_status(): diff --git a/app/classes/shared/helpers.py b/app/classes/shared/helpers.py index b02e1d8e..aeaa3e68 100644 --- a/app/classes/shared/helpers.py +++ b/app/classes/shared/helpers.py @@ -225,16 +225,6 @@ class Helpers: version_data.get('meta', '?')) return str(version) - def do_exit(self): - exit_file = os.path.join(self.root_dir, 'exit.txt') - try: - open(exit_file, 'a').close() - - except Exception as e: - logger.critical("Unable to create exit file!") - console.critical("Unable to create exit file!") - sys.exit(1) - def encode_pass(self, password): return self.passhasher.hash(password) diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py index 1b4ad0c0..3bda0268 100644 --- a/app/classes/shared/server.py +++ b/app/classes/shared/server.py @@ -170,12 +170,10 @@ class Server: if not helper.check_path_exists(self.server_path): logger.critical("Server path: {} does not seem to exits".format(self.server_path)) console.critical("Server path: {} does not seem to exits".format(self.server_path)) - helper.do_exit() if not helper.check_writeable(self.server_path): logger.critical("Unable to write/access {}".format(self.server_path)) console.warning("Unable to write/access {}".format(self.server_path)) - helper.do_exit() def start_server(self, user_lang): diff --git a/app/classes/shared/tasks.py b/app/classes/shared/tasks.py index 800335b9..d0ede9c9 100644 --- a/app/classes/shared/tasks.py +++ b/app/classes/shared/tasks.py @@ -48,7 +48,6 @@ class TasksManager: self.webserver_thread = threading.Thread(target=self.tornado.run_tornado, daemon=True, name='tornado_thread') - self.main_kill_switch_thread = threading.Thread(target=self.main_kill_switch, daemon=True, name="main_loop") self.main_thread_exiting = False self.schedule_thread = threading.Thread(target=self.scheduler_thread, daemon=True, name="scheduler") @@ -65,16 +64,6 @@ class TasksManager: def get_main_thread_run_status(self): return self.main_thread_exiting - def start_main_kill_switch_watcher(self): - self.main_kill_switch_thread.start() - - def main_kill_switch(self): - while True: - if os.path.exists(os.path.join(helper.root_dir, 'exit.txt')): - logger.info("Found Exit File, stopping everything") - self._main_graceful_exit() - time.sleep(5) - def reload_schedule_from_db(self): jobs = management_helper.get_schedules_enabled() schedule.clear(tag='backup') @@ -122,7 +111,6 @@ class TasksManager: def _main_graceful_exit(self): try: os.remove(helper.session_file) - os.remove(os.path.join(helper.root_dir, 'exit.txt')) os.remove(os.path.join(helper.root_dir, '.header')) self.controller.stop_all_servers() except: diff --git a/main.py b/main.py index 561ea12a..62fa0126 100644 --- a/main.py +++ b/main.py @@ -128,9 +128,6 @@ if __name__ == '__main__': # refresh our cache and schedule for every 12 hoursour cache refresh for serverjars.com tasks_manager.serverjar_cache_refresher() - # this should always be last - tasks_manager.start_main_kill_switch_watcher() - logger.info("Checking Internet/Port Service. This may take a minute.") console.info("Checking Internet/Port Service. This may take a minute.")