[WIP] Fix nxos_banner (#28607)

* Fix `'state': 'absent'`

* Replace idempotence tests with references

* Fix issues with nxos_banner
This commit is contained in:
Nathaniel Case 2017-08-28 17:09:54 -04:00 committed by GitHub
commit 862cde5e82
4 changed files with 16 additions and 46 deletions

View file

@ -6,7 +6,7 @@
provider: "{{ connection }}"
- name: Set exec
nxos_banner:
nxos_banner: &exec
banner: exec
text: |
this is my exec banner
@ -16,23 +16,13 @@
provider: "{{ connection }}"
register: result
- debug:
msg: "{{ result }}"
- assert:
that:
- "result.changed == true"
- "'banner exec @\nthis is my exec banner\nthat has a multiline\nstring\n@' in result.commands"
- name: Set exec again (idempotent)
nxos_banner:
banner: exec
text: |
this is my exec banner
that has a multiline
string
state: present
provider: "{{ connection }}"
nxos_banner: *exec
register: result
- assert:

View file

@ -6,7 +6,7 @@
provider: "{{ connection }}"
- name: Set motd
nxos_banner:
nxos_banner: &motd
banner: motd
text: |
this is my motd banner
@ -16,23 +16,13 @@
provider: "{{ connection }}"
register: result
- debug:
msg: "{{ result }}"
- assert:
that:
- "result.changed == true"
- "'banner motd @\nthis is my motd banner\nthat has a multiline\nstring\n@' in result.commands"
- name: Set motd again (idempotent)
nxos_banner:
banner: motd
text: |
this is my motd banner
that has a multiline
string
state: present
provider: "{{ connection }}"
nxos_banner: *motd
register: result
- assert:
@ -40,7 +30,6 @@
- "result.changed == false"
- "result.commands | length == 0"
# FIXME add in tests for everything defined in docs
# FIXME Test state:absent + test:
# FIXME Without powers ensure "privileged mode required"

View file

@ -9,25 +9,19 @@
provider: "{{ connection }}"
- name: remove exec
nxos_banner:
nxos_banner: &rm-exec
banner: exec
state: absent
provider: "{{ connection }}"
register: result
- debug:
msg: "{{ result }}"
- assert:
that:
- "result.changed == true"
- "'no banner exec' in result.commands"
- name: remove exec (idempotent)
nxos_banner:
banner: exec
state: absent
provider: "{{ connection }}"
nxos_banner: *rm-exec
register: result
- assert:
@ -35,7 +29,6 @@
- "result.changed == false"
- "result.commands | length == 0"
# FIXME add in tests for everything defined in docs
# FIXME Test state:absent + test:
# FIXME Without powers ensure "privileged mode required"