1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Check number of vault secrets after setup. (#30520)

This is to catch vault secrets from config and
cli. Previously vault_password_file in config was
missed since it was added by setup_vault_secrets,
so check after setup_vault_secrets.
This commit is contained in:
Adrian Likins 2017-09-20 10:31:36 -04:00 committed by GitHub
parent 18582295e3
commit 174cb1f33c

View file

@ -184,6 +184,10 @@ class VaultCLI(CLI):
vault_password_files=self.options.vault_password_files, vault_password_files=self.options.vault_password_files,
ask_vault_pass=self.options.ask_vault_pass, ask_vault_pass=self.options.ask_vault_pass,
create_new_password=True) create_new_password=True)
if len(vault_secrets) > 1:
raise AnsibleOptionsError("Only one --vault-id can be used for encryption. This includes passwords from configuration and cli.")
if not vault_secrets: if not vault_secrets:
raise AnsibleOptionsError("A vault password is required to use Ansible's Vault") raise AnsibleOptionsError("A vault password is required to use Ansible's Vault")