backups: Minor refactoring

Tests:

- Adding a remote repository with key and password authentication works with and
without encryption.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2026-02-04 18:56:55 -08:00
parent 2208a7b210
commit a7ef60015c
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -330,18 +330,12 @@ class SshBorgRepository(BaseBorgRepository):
@property
def ssh_password(self) -> str | None:
"""Return SSH password if it is stored, otherwise None."""
if 'ssh_password' in self.credentials:
return self.credentials['ssh_password']
return None
return self.credentials.get('ssh_password')
@property
def ssh_keyfile(self) -> str | None:
"""Return path to SSH client key if stored, otherwise None."""
if 'ssh_keyfile' in self.credentials:
return self.credentials['ssh_keyfile']
return None
return self.credentials.get('ssh_keyfile')
@property
def _mountpoint(self):