support vault IDs that include dot characters

see: https://github.com/ansible/awx/issues/4009
This commit is contained in:
Ryan Petrello
2019-06-06 12:42:31 -04:00
parent 176f8632e5
commit 329b40fd69
2 changed files with 7 additions and 3 deletions

View File

@@ -1467,7 +1467,8 @@ class RunJob(BaseTask):
if k == 'vault_password':
args.append('--ask-vault-pass')
else:
vault_id = k.split('.')[1]
# split only on the first dot in case the vault ID itself contains a dot
vault_id = k.split('.', 1)[1]
args.append('--vault-id')
args.append('{}@prompt'.format(vault_id))
@@ -1533,7 +1534,8 @@ class RunJob(BaseTask):
d[r'Vault password:\s*?$'] = 'vault_password'
for k, v in passwords.items():
if k.startswith('vault_password.'):
vault_id = k.split('.')[1]
# split only on the first dot in case the vault ID itself contains a dot
vault_id = k.split('.', 1)[1]
d[r'Vault password \({}\):\s*?$'.format(vault_id)] = k
return d