diff --git a/admin/client/admin_client.py b/admin/client/admin_client.py index 5e9113725..5dd1dc45f 100644 --- a/admin/client/admin_client.py +++ b/admin/client/admin_client.py @@ -100,6 +100,7 @@ NUMBER: /[0-9]+/ %ignore WS """ + class AdminTransformer(Transformer): def start(self, items): @@ -182,6 +183,7 @@ class AdminTransformer(Transformer): def meta_args(self, items): return items + def encrypt(input_string): pub = '-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArq9XTUSeYr2+N1h3Afl/z8Dse/2yD0ZGrKwx+EEEcdsBLca9Ynmx3nIB5obmLlSfmskLpBo0UACBmB5rEjBp2Q2f3AG3Hjd4B+gNCG6BDaawuDlgANIhGnaTLrIqWrrcm4EMzJOnAOI1fgzJRsOOUEfaS318Eq9OVO3apEyCCt0lOQK6PuksduOjVxtltDav+guVAA068NrPYmRNabVKRNLJpL8w4D44sfth5RvZ3q9t+6RTArpEtc5sh5ChzvqPOzKGMXW83C95TxmXqpbK6olN4RevSfVjEAgCydH6HN6OhtOQEcnrU97r9H0iZOWwbw3pVrZiUkuRD1R56Wzs2wIDAQAB\n-----END PUBLIC KEY-----' pub_key = RSA.importKey(pub) @@ -189,10 +191,12 @@ def encrypt(input_string): cipher_text = cipher.encrypt(base64.b64encode(input_string.encode('utf-8'))) return base64.b64encode(cipher_text).decode("utf-8") + def encode_to_base64(input_string): base64_encoded = base64.b64encode(input_string.encode('utf-8')) return base64_encoded.decode('utf-8') + class AdminCLI(Cmd): def __init__(self): super().__init__() @@ -209,8 +213,16 @@ class AdminCLI(Cmd): def onecmd(self, command: str) -> bool: try: - print(f"command: {command}") + # print(f"command: {command}") result = self.parse_command(command) + + # if 'type' in result and result.get('type') == 'empty': + # return False + + if isinstance(result, dict): + if 'type' in result and result.get('type') == 'empty': + return False + self.execute_command(result) if isinstance(result, Tree): diff --git a/admin/server/admin_server.py b/admin/server/admin_server.py index e76b38642..7b3126f1d 100644 --- a/admin/server/admin_server.py +++ b/admin/server/admin_server.py @@ -26,7 +26,7 @@ from routes import admin_bp from api.utils.log_utils import init_root_logger from api.constants import SERVICE_CONF from api import settings -from config import load_configurations, SERVICE_CONFIGS +from admin.server.config import load_configurations, SERVICE_CONFIGS stop_event = threading.Event()