Fix issues with net_user tests on eos (#33691)

* Fix net_user/eos and also the horribly broken cleanup there

* The rest of net_user/eos has the same problem
This commit is contained in:
Nathaniel Case 2017-12-07 17:01:28 -05:00 committed by GitHub
parent 2d2f288e77
commit 551847beea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 14 deletions

View file

@ -1,4 +1,11 @@
---
- name: Setup
net_user: &clear_netop
name: netop
state: absent
authorize: yes
provider: "{{ cli }}"
- name: Set user to privilege level 15
net_user:
name: netop
@ -12,9 +19,7 @@
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username netop privilege 15"]'
- 'result.commands == ["username netop privilege 15", "username netop nopassword"]'
- name: tearDown
net_user:
purge: yes
provider: "{{ cli }}"
net_user: *clear_netop

View file

@ -1,9 +1,19 @@
---
- name: Setup
net_user: &clear_users
aggregate:
- name: netop
- name: netend
state: absent
authorize: yes
provider: "{{ cli }}"
- name: Set multiple users role
net_user:
aggregate:
- name: netop
- name: netend
nopassword: yes
role: network-operator
state: present
authorize: yes
@ -13,10 +23,7 @@
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username netop role network-operator", "username netend role network-operator"]'
- 'result.commands == ["username netop role network-operator", "username netop nopassword", "username netend role network-operator", "username netend nopassword"]'
- name: tearDown
net_user:
purge: yes
authorize: yes
provider: "{{ cli }}"
net_user: *clear_users

View file

@ -1,20 +1,27 @@
---
- name: Setup
net_user: &clear_netop
name: netop
state: absent
authorize: yes
provider: "{{ cli }}"
- name: Create user
net_user:
name: netop
nopassword: yes
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username netop"]'
- 'result.commands == ["username netop nopassword"]'
- name: Purge users
net_user:
purge: yes
provider: "{{ cli }}"
- name: tearDown
net_user: *clear_netop
register: result
- assert: