From ff054830bca7ce3ede3e6bcac8d89d7559193061 Mon Sep 17 00:00:00 2001 From: Charlie Crane Date: Thu, 8 Aug 2024 11:57:30 +0100 Subject: [PATCH] #2781 - Correcting some typos in Terminal notebook and elaborating the data in _remote_login request --- src/primaite/notebooks/Terminal-Processing.ipynb | 11 +++-------- .../simulator/system/services/terminal/terminal.py | 11 +++++++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/primaite/notebooks/Terminal-Processing.ipynb b/src/primaite/notebooks/Terminal-Processing.ipynb index f3848c84..fdf405a7 100644 --- a/src/primaite/notebooks/Terminal-Processing.ipynb +++ b/src/primaite/notebooks/Terminal-Processing.ipynb @@ -87,7 +87,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "You can view all active connections to a terminal through use of the `show()` method, " + "You can view all active connections to a terminal through use of the `show()` method." ] }, { @@ -96,11 +96,7 @@ "metadata": {}, "outputs": [], "source": [ - "terminal_b.show()\n", - "print(term_a_term_b_remote_connection.ssh_session_id)\n", - "computer_b.user_session_manager.show(include_session_id=True)\n", - "computer_b.user_session_manager.show()\n", - "\n" + "terminal_b.show()" ] }, { @@ -184,7 +180,6 @@ "term_a_term_b_remote_connection.disconnect()\n", "\n", "terminal_a.show()\n", - "\n", "terminal_b.show()" ] }, @@ -192,7 +187,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Disconnected Terminal sessions will no longer show in the node's `user_session_manager` as active, but will be under the historic sessions" + "Disconnected Terminal sessions will no longer show in the node's Terminal connection list, but will be under the historic sessions in the `user_session_manager`." ] }, { diff --git a/src/primaite/simulator/system/services/terminal/terminal.py b/src/primaite/simulator/system/services/terminal/terminal.py index 46386d3b..aa3b5d62 100644 --- a/src/primaite/simulator/system/services/terminal/terminal.py +++ b/src/primaite/simulator/system/services/terminal/terminal.py @@ -181,12 +181,19 @@ class Terminal(Service): }, ) else: - return RequestResponse(status="failure", data={}) + return RequestResponse(status="failure", data={"reason": "Invalid login credentials"}) def _remote_login(request: RequestFormat, context: Dict) -> RequestResponse: login = self._send_remote_login(username=request[0], password=request[1], ip_address=request[2]) if login: - return RequestResponse(status="success", data={}) + return RequestResponse( + status="success", + data={ + "connection ID": login.connection_uuid, + "ssh_session_id": login.ssh_session_id, + "ip_address": login.ip_address, + }, + ) else: return RequestResponse(status="failure", data={})