Fix junos_user purge option failures (#28867)

* Fix junos_user pruge option failures

Fixes #25989

Add seperate handling for purge option which
fetches configured users on remote device
and delete the one not present in aggregate
list.

* Minor changes
This commit is contained in:
Ganesh Nalawade 2017-08-31 17:46:13 +05:30 committed by GitHub
commit a6af204cee
3 changed files with 66 additions and 16 deletions

View file

@ -168,3 +168,26 @@
- "result.changed == true"
- "'<name>test_user1</name>' not in config.xml"
- "'<name>test_user2</name>' not in config.xml"
- name: Create list of users
junos_user:
aggregate:
- name: ansible
- {name: test_user1, full_name: test_user2, role: operator}
- {name: test_user2, full_name: test_user2, role: read-only}
provider: "{{ netconf }}"
register: result
- name: Purge users except the users in aggregate
junos_user:
aggregate:
- name: ansible
purge: True
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- result.diff.prepared | search("\- *user test_user1")
- result.diff.prepared | search("\- *user test_user2")