mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
Use ssh-agent for encrypted ssh_key_data even when ssh_key_unlock is empty.
This commit is contained in:
parent
86599cf1e3
commit
762e8656c5
@ -403,7 +403,9 @@ class RunJob(BaseTask):
|
|||||||
value = kwargs.get(field, decrypt_field(creds, 'password'))
|
value = kwargs.get(field, decrypt_field(creds, 'password'))
|
||||||
else:
|
else:
|
||||||
value = kwargs.get(field, decrypt_field(creds, field))
|
value = kwargs.get(field, decrypt_field(creds, field))
|
||||||
if value not in ('', 'ASK'):
|
if field == 'ssh_key_unlock' and value != 'ASK':
|
||||||
|
passwords[field] = value
|
||||||
|
elif value not in ('', 'ASK'):
|
||||||
passwords[field] = value
|
passwords[field] = value
|
||||||
return passwords
|
return passwords
|
||||||
|
|
||||||
@ -487,7 +489,8 @@ class RunJob(BaseTask):
|
|||||||
|
|
||||||
# If private key isn't encrypted, pass the path on the command line.
|
# If private key isn't encrypted, pass the path on the command line.
|
||||||
ssh_key_path = kwargs.get('private_data_file', '')
|
ssh_key_path = kwargs.get('private_data_file', '')
|
||||||
use_ssh_agent = bool(kwargs.get('passwords', {}).get('ssh_key_unlock', ''))
|
ssh_key_unlock = kwargs.get('passwords', {}).get('ssh_key_unlock', None)
|
||||||
|
use_ssh_agent = bool(ssh_key_unlock is not None)
|
||||||
if ssh_key_path and not use_ssh_agent:
|
if ssh_key_path and not use_ssh_agent:
|
||||||
args.append('--private-key=%s' % ssh_key_path)
|
args.append('--private-key=%s' % ssh_key_path)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user