fix critical bug to support relative path for crafty logs. Crafty's root path is set by main.py and saved in controller.

This commit is contained in:
Andrew 2022-01-13 23:01:18 -05:00
parent 1ee8342355
commit 64b62f0f4f
2 changed files with 8 additions and 1 deletions

View File

@ -130,6 +130,10 @@ class Controller:
else:
return False
def set_project_root(self, root_dir):
self.project_root = root_dir
def package_support_logs(self, exec_user):
time.sleep(5)
websocket_helper.broadcast_user(exec_user['user_id'], 'notification', 'Preparing your support logs')
@ -159,7 +163,7 @@ class Controller:
shutil.copy(server['log_path'], final_path)
#Copy crafty logs to archive dir
full_log_name = os.path.join(crafty_path, 'logs')
shutil.copytree("logs", full_log_name)
shutil.copytree(os.path.join(self.project_root, 'logs'), full_log_name)
shutil.make_archive(tempZipStorage, "zip", tempDir)
tempZipStorage += '.zip'

View File

@ -151,6 +151,9 @@ if __name__ == '__main__':
Crafty = MainPrompt(tasks_manager, migration_manager)
project_root = os.path.dirname(__file__)
controller.set_project_root(project_root)
def sigterm_handler(signum, current_stack_frame):
print() # for newline
logger.info("Recieved SIGTERM, stopping Crafty")