Skip to content

Commit

Permalink
Merge pull request #486 from dezeroku/hashivault_auth_list_check_mode
Browse files Browse the repository at this point in the history
Add check mode support to hashivault_auth_list
  • Loading branch information
TerryHowe authored Jul 10, 2024
2 parents e37b89b + 7654909 commit 2712b69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ansible/modules/hashivault/hashivault_auth_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

def main():
argspec = hashivault_argspec()
module = hashivault_init(argspec)
module = hashivault_init(argspec, supports_check_mode=True)
result = hashivault_auth_list(module.params)
if result.get('failed'):
module.fail_json(**result)
Expand Down
8 changes: 8 additions & 0 deletions functional/test_auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
- hosts: localhost
gather_facts: no
tasks:
- hashivault_auth_list:
register: auth_list
- assert: { that: "'token/' in auth_list.backends" }
- assert: { that: "'userpass/' not in auth_list.backends" }
- name: Delete any lingering userpass
hashivault_auth_method:
method_type: "userpass"
Expand All @@ -16,6 +20,10 @@
- assert: { that: "vault_auth.created == True" }
- assert: { that: "vault_auth.failed == False" }
- assert: { that: "vault_auth.rc == 0" }
- hashivault_auth_list:
check_mode: true
register: auth_list
- assert: { that: "'userpass/' in auth_list.backends" }
- name: Enable userpass when it is already enabled
hashivault_auth_method:
method_type: "userpass"
Expand Down

0 comments on commit 2712b69

Please sign in to comment.