summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDag Wieers <dag@wieers.com>2018-07-06 13:32:39 +0200
committerGitHub <noreply@github.com>2018-07-06 13:32:39 +0200
commitf98a0b521fc551bfc0771dff0840a02ee7492eb4 (patch)
treea41ae45806e58d7a1848130da5e843da19522e8d
parentFix typo in cliconf pluign (#42399) (diff)
downloadansible-f98a0b521fc551bfc0771dff0840a02ee7492eb4.tar.xz
ansible-f98a0b521fc551bfc0771dff0840a02ee7492eb4.zip
Add querying all bindings (#42366)
Also fix an issue with one of the check-mode tests.
-rw-r--r--lib/ansible/modules/network/aci/aci_static_binding_to_epg.py5
-rw-r--r--test/integration/targets/aci_static_binding_to_epg/tasks/main.yml19
2 files changed, 11 insertions, 13 deletions
diff --git a/lib/ansible/modules/network/aci/aci_static_binding_to_epg.py b/lib/ansible/modules/network/aci/aci_static_binding_to_epg.py
index ddcb4072d6..716eb3708d 100644
--- a/lib/ansible/modules/network/aci/aci_static_binding_to_epg.py
+++ b/lib/ansible/modules/network/aci/aci_static_binding_to_epg.py
@@ -302,9 +302,10 @@ def main():
interface_mode = module.params['interface_mode']
interface_type = module.params['interface_type']
pod_id = module.params['pod_id']
- # 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']]
+ 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 len(leafs) == 1:
if interface_type != 'vpc':
leafs = leafs[0]
diff --git a/test/integration/targets/aci_static_binding_to_epg/tasks/main.yml b/test/integration/targets/aci_static_binding_to_epg/tasks/main.yml
index 1f19f380df..2b55654e36 100644
--- a/test/integration/targets/aci_static_binding_to_epg/tasks/main.yml
+++ b/test/integration/targets/aci_static_binding_to_epg/tasks/main.yml
@@ -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: