Fix mypy error for the SSH user in the sshpass command

Check that ssh_user is set before quoting it. It always is in remote mode, but mypy can't know that.
This commit is contained in:
Fuxino
2026-10-14 08:32:00 +02:00
parent 8d08032b5d
commit d803790c1a
+1 -1
View File
@@ -630,7 +630,7 @@ class Backup:
# rsync splits the -e command itself, so quote the parts that may contain spaces
if self.ssh_keyfile is not None:
ssh = f'ssh -i {shlex.quote(self.ssh_keyfile)} -o StrictHostKeyChecking=accept-new'
elif self._password_auth and which('sshpass'):
elif self._password_auth and self.ssh_user is not None and which('sshpass'):
ssh = f'sshpass -e ssh -l {shlex.quote(self.ssh_user)} -o StrictHostKeyChecking=accept-new'
else:
ssh = 'ssh -o StrictHostKeyChecking=accept-new'