mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-28 11:59:09 -07:00
parent
25e3fe04a8
commit
368f4448dc
4 changed files with 14 additions and 18 deletions
|
@ -93,7 +93,12 @@ class VaultCLI(CLI):
|
|||
# read vault_pass from a file
|
||||
self.vault_pass = CLI.read_vault_password_file(self.options.vault_password_file, loader)
|
||||
else:
|
||||
self.vault_pass, _= self.ask_vault_passwords(ask_vault_pass=True, ask_new_vault_pass=False, confirm_new=False)
|
||||
newpass = False
|
||||
rekey = False
|
||||
if self.options.new_vault_password_file:
|
||||
newpass = self.action in ['create', 'rekey', 'encrypt']
|
||||
rekey = self.action == 'rekey'
|
||||
self.vault_pass, self.new_vault_pass = self.ask_vault_passwords(ask_new_vault_pass=newpass, rekey=rekey)
|
||||
|
||||
if self.options.new_vault_password_file:
|
||||
# for rekey only
|
||||
|
@ -149,12 +154,7 @@ class VaultCLI(CLI):
|
|||
if not (os.path.isfile(f)):
|
||||
raise AnsibleError(f + " does not exist")
|
||||
|
||||
if self.new_vault_pass:
|
||||
new_password = self.new_vault_pass
|
||||
else:
|
||||
__, new_password = self.ask_vault_passwords(ask_vault_pass=False, ask_new_vault_pass=True, confirm_new=True)
|
||||
|
||||
for f in self.args:
|
||||
self.editor.rekey_file(f, new_password)
|
||||
self.editor.rekey_file(f, self.new_vault_pass)
|
||||
|
||||
self.display.display("Rekey successful", stderr=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue