1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2025-01-03 05:36:19 +00:00

simplify code

one line more, but easier and only 1 dict access instead of 3.
This commit is contained in:
Thomas Waldmann 2018-11-22 03:06:16 +01:00
parent 94e21ab001
commit d6ab81c37e

View file

@ -42,12 +42,14 @@ def __init__(self, cmd, params, parent=None):
env = os.environ.copy()
env['BORG_HOSTNAME_IS_UNIQUE'] = '1'
if params.get('password') and params['password'] is not None:
env['BORG_PASSPHRASE'] = params['password']
password = params.get('password')
if password is not None:
env['BORG_PASSPHRASE'] = password
env['BORG_RSH'] = 'ssh -oStrictHostKeyChecking=no'
if params.get('ssh_key') and params['ssh_key'] is not None:
env['BORG_RSH'] += f' -i ~/.ssh/{params["ssh_key"]}'
ssh_key = params.get('ssh_key')
if ssh_key is not None:
env['BORG_RSH'] += f' -i ~/.ssh/{ssh_key}'
self.env = env
self.cmd = cmd