1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add querying all bindings (#42366)

Also fix an issue with one of the check-mode tests.
This commit is contained in:
Dag Wieers 2018-07-06 13:32:39 +02:00 committed by GitHub
parent 5635848654
commit f98a0b521f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 13 deletions

View file

@ -302,9 +302,10 @@ def main():
interface_mode = module.params['interface_mode']
interface_type = module.params['interface_type']
pod_id = module.params['pod_id']
leafs = module.params['leafs']
if leafs is not None:
# Users are likely to use integers for leaf IDs, which would raise an exception when using the join method
leafs = [str(leaf) for leaf in module.params['leafs']]
if leafs is not None:
if len(leafs) == 1:
if interface_type != 'vpc':
leafs = leafs[0]

View file

@ -85,6 +85,7 @@
aci_static_binding_to_epg:
<<: *primary_encap_id_present
description: Binding description
check_mode: yes
register: description_cm
- name: Bind contract to epg - update description (run mode)
@ -126,22 +127,21 @@
- idempotent_description_cm.changed == false
- idempotent_description.changed == false
- missing_required_present.failed == true
- 'missing_required_present.msg == "missing required arguments: interface_type"'
- 'missing_required_present.msg == "state is present but all of the following are missing: ap, encap_id, epg, interface, leafs, pod_id"'
- missing_required_present.failed == true
- name: Get binding
- name: Query specific binding
aci_static_binding_to_epg:
<<: *primary_encap_id_present
state: query
register: query_static_binding
- name: Missing required param - failure message works
- name: Query all bindings
aci_static_binding_to_epg:
<<: *aci_tenant_present
state: query
ignore_errors: yes
register: missing_required_query
register: query_all
- name: Query assertions
assert:
@ -149,11 +149,8 @@
- query_static_binding.changed == false
- query_static_binding.current != []
- '"class/fvRsPathAtt.json" in query_static_binding.url'
# FIXME: possibility to query all the static bindings
# - query_all.changed == false
# - '"class/fvRsPathAtt.json" in query_all.url'
- missing_required_query.failed == true
- 'missing_required_query.msg == "missing required arguments: interface_type"'
- query_all.changed == false
- '"class/fvRsPathAtt.json" in query_all.url'
- name: Delete provide binding - deletion works
@ -184,7 +181,7 @@
- provide_absent_idempotent.previous == []
- missing_param_absent.failed == true
- missing_param_absent.failed == true
- 'missing_param_absent.msg == "missing required arguments: interface_type"'
- 'missing_param_absent.msg == "state is absent but all of the following are missing: ap, epg, interface, leafs, pod_id"'
- name: Cleanup binding
aci_static_binding_to_epg: