Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding fix for deleting users using V3 module #526

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions tests/integration/targets/ntnx_users_v2/tasks/users_operations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,24 @@
# fail_msg: Delete users if already exist failed
# success_msg: Delete users if already exist passed
# when: todelete | length > 0
- name: Delete created users

- name: Delete users if already exist
ntnx_users:
state: absent
user_uuid: "{{ item }}"
loop: "{{ todelete }}"
register: result
ignore_errors: true
when: todelete | length > 0

- name: Check listing status
- name: Delete users if already exist status
ansible.builtin.assert:
that:
- result.changed == true
- result.msg == "All items completed"
fail_msg: "Fail: unable to delete all users"
success_msg: "Pass: all users deleted successfully"
fail_msg: Delete users if already exist failed
success_msg: Delete users if already exist passed
when: todelete | length > 0

- name: Reset todelete list
ansible.builtin.set_fact:
Expand Down Expand Up @@ -609,14 +612,20 @@
loop: "{{ todelete }}"
register: result
ignore_errors: true
no_log: true

- name: Check listing status
- name: Delete created users status
ansible.builtin.assert:
that:
- result.changed == true
- result.msg == "All items completed"
fail_msg: "Fail: unable to delete all users"
success_msg: "Pass: all users deleted successfully"
- result.results | length == todelete | length
- item.failed == false
fail_msg: Delete created users failed
success_msg: Delete created users passed
loop: "{{ result.results }}"
when: todelete | length > 0 and result | length > 0
no_log: true

- name: Reset todelete list
ansible.builtin.set_fact:
Expand Down
Loading