(20250219) fml
This commit is contained in:
@@ -120,7 +120,7 @@ def init(blueprint_setup_state):
|
|||||||
attr_name = "logs_mongo",
|
attr_name = "logs_mongo",
|
||||||
project = constants.PROJECT_NAME,
|
project = constants.PROJECT_NAME,
|
||||||
log_type = constants.MODULE_NAME,
|
log_type = constants.MODULE_NAME,
|
||||||
operation = "smsAuthApi",
|
operation = "softwareAuthApi",
|
||||||
log_input = True,
|
log_input = True,
|
||||||
log_output = True,
|
log_output = True,
|
||||||
sensitive_keys = ["sessionToken", "X-Session-Token"]
|
sensitive_keys = ["sessionToken", "X-Session-Token"]
|
||||||
@@ -228,7 +228,8 @@ async def authorize_software_client(
|
|||||||
response = await current_app.mikrotik_hotspot_1000_controller.save_auth(
|
response = await current_app.mikrotik_hotspot_1000_controller.save_auth(
|
||||||
sql_conn = current_app.sql_writer,
|
sql_conn = current_app.sql_writer,
|
||||||
mongo_data_conn = current_app.data_mongo,
|
mongo_data_conn = current_app.data_mongo,
|
||||||
mikrotik_auth = inbound_data.auth
|
mikrotik_auth = inbound_data.auth,
|
||||||
|
action_chain = kwargs.get("log_id")
|
||||||
)
|
)
|
||||||
|
|
||||||
# Note down the results:
|
# Note down the results:
|
||||||
|
|||||||
@@ -686,7 +686,8 @@ class MikroTikHotspot1000Controller(MikroTikController):
|
|||||||
self,
|
self,
|
||||||
sql_conn: AsyncMySQL,
|
sql_conn: AsyncMySQL,
|
||||||
mongo_data_conn: AsyncMongo,
|
mongo_data_conn: AsyncMongo,
|
||||||
mikrotik_auth: MikroTikHotspot1000Auth
|
mikrotik_auth: MikroTikHotspot1000Auth,
|
||||||
|
action_chain: str | int = None
|
||||||
) -> MikroTikAuthResponse:
|
) -> MikroTikAuthResponse:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -695,6 +696,7 @@ class MikroTikHotspot1000Controller(MikroTikController):
|
|||||||
:param sql_conn: The database connection to use to perform this task.
|
:param sql_conn: The database connection to use to perform this task.
|
||||||
:param mongo_data_conn: The database connection to use to perform this task.
|
:param mongo_data_conn: The database connection to use to perform this task.
|
||||||
:param mikrotik_auth: The set of credentials as received from the UI/API.
|
:param mikrotik_auth: The set of credentials as received from the UI/API.
|
||||||
|
:param action_chain: A custom action chain to apply for logging the steps.
|
||||||
:return: A structured response to indicate what happened during authorization.
|
:return: A structured response to indicate what happened during authorization.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -712,6 +714,7 @@ class MikroTikHotspot1000Controller(MikroTikController):
|
|||||||
http_client = None,
|
http_client = None,
|
||||||
action_log_conn = mongo_data_conn
|
action_log_conn = mongo_data_conn
|
||||||
)
|
)
|
||||||
|
mikrotik_client.new_action_chain(action_chain)
|
||||||
|
|
||||||
# Try to configure the device:
|
# Try to configure the device:
|
||||||
config_response = await self.quick_config(mikrotik_client, mikrotik_auth, use_https = False)
|
config_response = await self.quick_config(mikrotik_client, mikrotik_auth, use_https = False)
|
||||||
|
|||||||
@@ -401,14 +401,16 @@ class AsyncMikroTik:
|
|||||||
): return True
|
): return True
|
||||||
else: return False
|
else: return False
|
||||||
|
|
||||||
def new_action_chain(self) -> None:
|
def new_action_chain(self, action_chain: str | int = None) -> None:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Generates a new random string to mark a new action chain and saves it in the local variable.
|
Generates a new random string to mark a new action chain and saves it in the local variable.
|
||||||
|
:param action_chain: A custom action chain to start using. A random string will be created if not provided.
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self._action_log_chain = "".join(random.choices(string.ascii_letters + string.digits, k = 8))
|
if action_chain: self._action_log_chain = action_chain
|
||||||
|
else: self._action_log_chain = "".join(random.choices(string.ascii_letters + string.digits, k = 8))
|
||||||
|
|
||||||
async def log_action(
|
async def log_action(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user