mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-07 22:03:18 +00:00
Fix symmetric vault password change when using password_files.
When using changing passwords, using password files, the file name was being used as the password, and not its content. This patch fixes the behavior to use the contents of the password file. Tests have been added to ensure the correct behavior.
This commit is contained in:
@@ -565,17 +565,16 @@ def change_password(module, res_find, password, password_file, new_password,
|
||||
if password:
|
||||
args["password"] = password
|
||||
if password_file:
|
||||
args["password"] = password_file
|
||||
args["password_file"] = password_file
|
||||
# retrieve current stored data
|
||||
result = api_command(module, 'vault_retrieve', name, args)
|
||||
args['data'] = result['result']['data']
|
||||
|
||||
# modify arguments to store data with new password.
|
||||
if password:
|
||||
args = {"override_password": True, "data": result['result']['data']}
|
||||
if new_password:
|
||||
args["password"] = new_password
|
||||
if password_file:
|
||||
args["password"] = new_password_file
|
||||
args["override_password"] = True
|
||||
if new_password_file:
|
||||
args["password_file"] = new_password_file
|
||||
# return the command to store data with the new password.
|
||||
return [(name, "vault_archive", args)]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user