Skip to content

Commit

Permalink
Check number of vault secrets after setup. (ansible#30520)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alikins authored Sep 20, 2017
1 parent 1858229 commit 174cb1f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ansible/cli/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ def run(self):
vault_password_files=self.options.vault_password_files,
ask_vault_pass=self.options.ask_vault_pass,
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:
raise AnsibleOptionsError("A vault password is required to use Ansible's Vault")

Expand Down

0 comments on commit 174cb1f

Please sign in to comment.