Repository: ansible/ansible

Issue:
ACI: integration test failure
##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
aci_bd_subnet
aci_contract_subject
aci_filter_entry

##### ANSIBLE VERSION
v2.5

##### SUMMARY
The following tests failed:

**aci_bd_subnet**
```
TASK [aci_bd_subnet : get all in bd] ******************************************************************************************************************************************************************************
task path: /home/dag/home-made/ansible.git/test/integration/targets/aci_bd_subnet/tasks/main.yml:126
Using module file /home/dag/home-made/ansible.git/lib/ansible/modules/network/aci/aci_bd_subnet.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: dag
<127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/dag/.ansible/tmp/ansible-tmp-1516475732.33-191885580229472 `" && echo ansible-tmp-1516475732.33-191885580229472="` echo /home/dag/.ansible/tmp/ansible-tmp-1516475732.33-191885580229472 `" ) && sleep 0'
<127.0.0.1> PUT /home/dag/.ansible/tmp/ansible-local-211245wJGDF/tmpC1Zc83 TO /home/dag/.ansible/tmp/ansible-tmp-1516475732.33-191885580229472/aci_bd_subnet.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/dag/.ansible/tmp/ansible-tmp-1516475732.33-191885580229472/ /home/dag/.ansible/tmp/ansible-tmp-1516475732.33-191885580229472/aci_bd_subnet.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/tmp/ansible-test-coverage-TjwnOo/coverage/injector.py /home/dag/.ansible/tmp/ansible-tmp-1516475732.33-191885580229472/aci_bd_subnet.py && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_dTLgAO/ansible_module_aci_bd_subnet.py", line 333, in <module>
    main()
  File "/tmp/ansible_dTLgAO/ansible_module_aci_bd_subnet.py", line 296, in main
    child_classes=['fvRsBDSubnetToProfile', 'fvRsNdPfxPol'],
  File "/tmp/ansible_dTLgAO/ansible_modlib.zip/ansible/module_utils/network/aci/aci.py", line 378, in construct_url
  File "/tmp/ansible_dTLgAO/ansible_modlib.zip/ansible/module_utils/network/aci/aci.py", line 525, in _construct_url_3
IndexError: tuple index out of range

fatal: [localhost]: FAILED! => {
    "attempts": 1, 
    "changed": false, 
    "failed": true, 
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_dTLgAO/ansible_module_aci_bd_subnet.py\", line 333, in <module>\n    main()\n  File \"/tmp/ansible_dTLgAO/ansible_module_aci_bd_subnet.py\", line 296, in main\n    child_classes=['fvRsBDSubnetToProfile', 'fvRsNdPfxPol'],\n  File \"/tmp/ansible_dTLgAO/ansible_modlib.zip/ansible/module_utils/network/aci/aci.py\", line 378, in construct_url\n  File \"/tmp/ansible_dTLgAO/ansible_modlib.zip/ansible/module_utils/network/aci/aci.py\", line 525, in _construct_url_3\nIndexError: tuple index out of range\n", 
    "module_stdout": "", 
    "msg": "MODULE FAILURE", 
    "rc": 1
}
	to retry, use: --limit @/home/dag/home-made/ansible.git/test/integration/aci_bd_subnet-6tRWH_.retry

PLAY RECAP ********************************************************************************************************************************************************************************************************
localhost                  : ok=14   changed=5    unreachable=0    failed=1   
```

Same happens for:
- aci_filter_entry
- aci_contract_subject


Discussion:
Files identified in the description:
* [lib/ansible/modules/network/aci/aci_bd_subnet.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/aci/aci_bd_subnet.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @brunocalogero @jmcgill298 @schunduri
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
Files identified in the description:
* [lib/ansible/modules/network/aci/aci_bd_subnet.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/aci/aci_bd_subnet.py)
* [lib/ansible/modules/network/aci/aci_contract_subject.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/aci/aci_contract_subject.py)
* [lib/ansible/modules/network/aci/aci_filter_entry.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/aci/aci_filter_entry.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->

Resolving patch:
diff --git a/lib/ansible/module_utils/network/aci/aci.py b/lib/ansible/module_utils/network/aci/aci.py
--- a/lib/ansible/module_utils/network/aci/aci.py
+++ b/lib/ansible/module_utils/network/aci/aci.py
@@ -522,7 +522,7 @@ def _construct_url_3(self, root, parent, obj, child_includes):
             # matching the provided ID value for the parent object
             else:
                 path = 'api/class/{0}.json'.format(parent_class)
-                filter_string = '?query-target-filter={1}{2}'.format(parent_filter, self_child_includes)
+                filter_string = '?query-target-filter={0}{1}'.format(parent_filter, self_child_includes)
         # Query for all objects of the module's class matching the provided ID value of the object
         else:
             path = 'api/class/{0}.json'.format(obj_class)


Test patch: