ACI: Change RETURN output as discussed (#35617)

* ACI: Change result output as discussed

* Update all modules to use new aci.exit_json()

* Update output_level spec and docs

* Fix integration tests

* Small PEP8 fix

* Asorted fixes to tests and aci_rest

* More test fixes and support for ANSIBLE_DEBUG

* Fix another PEP8 issues

* Move response handling inside ACI module

* Reform of ACI error handling and error output

* Diff multiline json output

* Fix a few more tests

* Revert aci_bd tests

* Small correction

* UI change: existing->current, original->previous

* UI change: config->sent

* Update all modules with RETURN values

* Fix a few more tests

* Improve docstring and add 'raw' return value

* Fix thinko

* Fix sanity/pep8 issues

* Rewrite unit tests to comply with new design
This commit is contained in:
Dag Wieers 2018-02-03 00:41:56 +01:00 committed by GitHub
commit bee765fa6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 5733 additions and 747 deletions

View file

@ -16,6 +16,7 @@
validate_certs: '{{ aci_validate_certs | default(false) }}'
use_ssl: '{{ aci_use_ssl | default(true) }}'
use_proxy: '{{ aci_use_proxy | default(true) }}'
output_level: debug
state: present
tenant: anstest
register: tenant_present
@ -73,15 +74,15 @@
assert:
that:
- epg_present_check_mode.changed == true
- epg_present_check_mode.existing == []
- epg_present_check_mode.config.fvAEPg.attributes != {}
- 'epg_present_check_mode.config.fvAEPg.children.0.fvRsBd.attributes.tnFvBDName == "anstest"'
- epg_present_check_mode.previous == []
- epg_present_check_mode.sent.fvAEPg.attributes != {}
- 'epg_present_check_mode.sent.fvAEPg.children.0.fvRsBd.attributes.tnFvBDName == "anstest"'
- epg_present.changed == true
- epg_present.config == epg_present_check_mode.config
- epg_present.sent == epg_present_check_mode.sent
- epg_present_idempotent.changed == false
- epg_present_idempotent.config == {}
- epg_present_idempotent.sent == {}
- epg_present_update.changed == true
- 'epg_present_update.config == {"fvAEPg": {"attributes": {"descr": "Ansible Test Update"}}}'
- 'epg_present_update.sent == {"fvAEPg": {"attributes": {"descr": "Ansible Test Update"}}}'
- epg_present_missing_param.failed == true
- 'epg_present_missing_param.msg == "state is present but all of the following are missing: ap"'
@ -102,11 +103,11 @@
assert:
that:
- epg_query.changed == false
- epg_query.existing | length == 1
- 'epg_query.existing.0.fvAEPg.attributes.name == "anstest"'
- epg_query.previous | length == 1
- 'epg_query.previous.0.fvAEPg.attributes.name == "anstest"'
- '"tn-anstest/ap-anstest/epg-anstest.json" in epg_query.url'
- epg_query_all.changed == false
- epg_query_all.existing | length > 1
- epg_query_all.previous | length > 1
- '"rsp-subtree-class=fvRsBd" in epg_query_all.filter_string'
- '"class/fvAEPg.json" in epg_query_all.url'
@ -143,11 +144,11 @@
assert:
that:
- delete_epg_check_mode.changed == true
- delete_epg_check_mode.existing != []
- delete_epg_check_mode.previous != []
- delete_epg.changed == true
- delete_epg.existing == delete_epg_check_mode.existing
- delete_epg.previous == delete_epg_check_mode.previous
- delete_epg_idempotent.changed == false
- delete_epg_idempotent.existing == []
- delete_epg_idempotent.previous == []
- delete_epg_missing_param.failed == true
- 'delete_epg_missing_param.msg == "state is absent but all of the following are missing: tenant"'
@ -155,16 +156,16 @@
aci_bd:
<<: *aci_bd_present
state: absent
when: bd_present.existing == []
when: bd_present.previous == []
- name: cleanup ap
aci_ap:
<<: *aci_ap_present
state: absent
when: ap_present.existing == []
when: ap_present.previous == []
- name: cleanup tenant
aci_tenant:
<<: *aci_tenant_present
state: absent
when: tenant_present.existing == []
when: tenant_present.previous == []