ansible-vault: convert vault_password_files to list to prevent traceback (#57186)

* Convert vault_password_files to a list

* Add changelog and tests
pull/57305/head
Sam Doran 6 years ago committed by Martin Krizek
parent 21cd24a0dd
commit 2e0229a4b6

@ -0,0 +1,2 @@
bugfixes:
- ansible-vault - fix error when multiple vault password files are specified (https://github.com/ansible/ansible/issues/57172)

@ -177,7 +177,7 @@ class VaultCLI(CLI):
vault_secrets = \
self.setup_vault_secrets(loader,
vault_ids=vault_ids,
vault_password_files=context.CLIARGS['vault_password_files'],
vault_password_files=list(context.CLIARGS['vault_password_files']),
ask_vault_pass=context.CLIARGS['ask_vault_pass'],
create_new_password=True)

@ -317,6 +317,10 @@ echo "rc was $WRONG_RC (1 is expected)"
ansible-vault encrypt_string "$@" --vault-password-file "${NEW_VAULT_PASSWORD}" "a test string"
# Test with multiple vault password files
# https://github.com/ansible/ansible/issues/57172
env ANSIBLE_VAULT_PASSWORD_FILE=vault-password ansible-vault encrypt_string "$@" --vault-password-file "${NEW_VAULT_PASSWORD}" --encrypt-vault-id default "a test string"
ansible-vault encrypt_string "$@" --vault-password-file "${NEW_VAULT_PASSWORD}" --name "blippy" "a test string names blippy"
ansible-vault encrypt_string "$@" --vault-id "${NEW_VAULT_PASSWORD}" "a test string"

Loading…
Cancel
Save