#1796: apply PR suggestions + fix tests
This commit is contained in:
@@ -83,15 +83,7 @@ class DatabaseService(Service):
|
||||
self.backup_server = backup_server
|
||||
|
||||
def backup_database(self) -> bool:
|
||||
"""
|
||||
Create a backup of the database to the configured backup server.
|
||||
|
||||
:param: backup_directory: Name of directory where backup will be stored. Optional.
|
||||
:type: backup_directory: Optional[str]
|
||||
|
||||
:param: backup_file_name: Name of file where backup will be stored. Optional.
|
||||
:type: backup_file_name: Optional[str]
|
||||
"""
|
||||
"""Create a backup of the database to the configured backup server."""
|
||||
# check if the backup server was configured
|
||||
if self.backup_server is None:
|
||||
self.sys_log.error(f"{self.name} - {self.sys_log.hostname}: not configured.")
|
||||
@@ -120,15 +112,7 @@ class DatabaseService(Service):
|
||||
return False
|
||||
|
||||
def restore_backup(self) -> bool:
|
||||
"""
|
||||
Restore a backup from backup server.
|
||||
|
||||
:param: backup_directory: Name of directory where backup will be stored. Optional.
|
||||
:type: backup_directory: Optional[str]
|
||||
|
||||
:param: backup_file_name: Name of file where backup will be stored. Optional.
|
||||
:type: backup_file_name: Optional[str]
|
||||
"""
|
||||
"""Restore a backup from backup server."""
|
||||
software_manager: SoftwareManager = self.software_manager
|
||||
ftp_client_service: FTPClient = software_manager.software["FTPClient"]
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ class FTPClient(FTPServiceABC):
|
||||
payload=payload, dest_ip_address=dest_ip_address, dest_port=dest_port
|
||||
)
|
||||
if payload.status_code == FTPStatusCode.OK:
|
||||
self.connected = None
|
||||
self.connected = False
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -162,13 +162,16 @@ class FTPClient(FTPServiceABC):
|
||||
else:
|
||||
self.sys_log.info(f"Sending file {src_folder_name}/{src_file_name} to {str(dest_ip_address)}")
|
||||
# send STOR request
|
||||
return self._send_data(
|
||||
if self._send_data(
|
||||
file=file_to_transfer,
|
||||
dest_folder_name=dest_folder_name,
|
||||
dest_file_name=dest_file_name,
|
||||
dest_ip_address=dest_ip_address,
|
||||
dest_port=dest_port,
|
||||
)
|
||||
):
|
||||
return self._disconnect_from_server(dest_ip_address=dest_ip_address, dest_port=dest_port)
|
||||
|
||||
return False
|
||||
|
||||
def request_file(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user