#2561 - Ran pre-commit hook
This commit is contained in:
@@ -163,7 +163,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "venv",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
@@ -177,9 +177,9 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.11"
|
||||
"version": "3.8.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
||||
@@ -43,10 +43,16 @@ class DatabaseService(Service):
|
||||
self._create_db_file()
|
||||
|
||||
def install(self):
|
||||
"""
|
||||
Perform first-time setup of the DatabaseService.
|
||||
|
||||
Installs an instance of FTPClient on the Node to enable database backup if it isn't installed already.
|
||||
"""
|
||||
super().install()
|
||||
if not self.software_manager.software.get("FTPClient"):
|
||||
self.sys_log.info(f"{self.name}: Installing FTPClient to enable database backups")
|
||||
self.software_manager.install(FTPClient)
|
||||
|
||||
def configure_backup(self, backup_server: IPv4Address):
|
||||
"""
|
||||
Set up the database backup.
|
||||
@@ -77,9 +83,7 @@ class DatabaseService(Service):
|
||||
|
||||
# send backup copy of database file to FTP server
|
||||
if not self.db_file:
|
||||
self.sys_log.error(
|
||||
f"{self.name}: Attempted to backup database file but it doesn't exist."
|
||||
)
|
||||
self.sys_log.error(f"{self.name}: Attempted to backup database file but it doesn't exist.")
|
||||
return False
|
||||
|
||||
response = ftp_client_service.send_file(
|
||||
@@ -170,11 +174,11 @@ class DatabaseService(Service):
|
||||
return str(uuid4())
|
||||
|
||||
def _process_connect(
|
||||
self,
|
||||
src_ip: IPv4Address,
|
||||
connection_request_id: str,
|
||||
password: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
self,
|
||||
src_ip: IPv4Address,
|
||||
connection_request_id: str,
|
||||
password: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
) -> Dict[str, Union[int, Dict[str, bool]]]:
|
||||
"""Process an incoming connection request.
|
||||
|
||||
@@ -215,10 +219,10 @@ class DatabaseService(Service):
|
||||
}
|
||||
|
||||
def _process_sql(
|
||||
self,
|
||||
query: Literal["SELECT", "DELETE", "INSERT", "ENCRYPT"],
|
||||
query_id: str,
|
||||
connection_id: Optional[str] = None,
|
||||
self,
|
||||
query: Literal["SELECT", "DELETE", "INSERT", "ENCRYPT"],
|
||||
query_id: str,
|
||||
connection_id: Optional[str] = None,
|
||||
) -> Dict[str, Union[int, List[Any]]]:
|
||||
"""
|
||||
Executes the given SQL query and returns the result.
|
||||
|
||||
@@ -357,7 +357,8 @@ def test_client_connection_terminate_does_not_terminate_another_clients_connecti
|
||||
assert db_connection_b.query("SELECT")
|
||||
assert len(db_service.connections) == 1
|
||||
|
||||
|
||||
def test_database_server_install_ftp_client():
|
||||
server = Server(hostname="db_server", ip_address="192.168.1.2", subnet_mask="255.255.255.0", start_up_duration=0)
|
||||
server.software_manager.install(DatabaseService)
|
||||
assert server.software_manager.software.get("FTPClient")
|
||||
assert server.software_manager.software.get("FTPClient")
|
||||
|
||||
Reference in New Issue
Block a user