mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-09 09:54:02 -07:00
Don't ask for password confirm on 'ansible-vault edit' (#30514)
* Don't ask for password confirm on 'ansible-vault edit' This is to match the 2.3 behavior on: ansible-vault edit encrypted_file.yml Previously, the above command would consider that a 'new password' scenario and prompt accordingly, ie: $ ansible-vault edit encrypted_file.yml New Password: Confirm New Password: The bug was cause by 'create_new_password' being used for 'edit' action. This also causes the previous implicit 'auto prompt' to get triggered and prompt the user. Fix is to make auto prompt explicit in the calling code to handle the 'edit' case where we want to auto prompt but we do not want to request a password confirm. Fixes #30491
This commit is contained in:
parent
71cc906ec8
commit
307be59092
3 changed files with 40 additions and 10 deletions
|
@ -165,7 +165,7 @@ class VaultCLI(CLI):
|
|||
|
||||
# TODO: instead of prompting for these before, we could let VaultEditor
|
||||
# call a callback when it needs it.
|
||||
if self.action in ['decrypt', 'view', 'rekey']:
|
||||
if self.action in ['decrypt', 'view', 'rekey', 'edit']:
|
||||
vault_secrets = self.setup_vault_secrets(loader,
|
||||
vault_ids=vault_ids,
|
||||
vault_password_files=self.options.vault_password_files,
|
||||
|
@ -173,7 +173,7 @@ class VaultCLI(CLI):
|
|||
if not vault_secrets:
|
||||
raise AnsibleOptionsError("A vault password is required to use Ansible's Vault")
|
||||
|
||||
if self.action in ['encrypt', 'encrypt_string', 'create', 'edit']:
|
||||
if self.action in ['encrypt', 'encrypt_string', 'create']:
|
||||
if len(vault_ids) > 1:
|
||||
raise AnsibleOptionsError("Only one --vault-id can be used for encryption")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue