summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag Wieers <dag@wieers.com>2018-12-10 13:05:06 +0100
committerToshio Kuratomi <a.badger@gmail.com>2018-12-10 10:22:41 -0800
commit2ba095f89e22c2b64b1f0a82b826a685dee14c53 (patch)
tree1c97780248a82e87209d442b6f40fa64d1a7d666
parentdb8f13c7026311769afa6920cf54c81af90bdb39 (diff)
downloadansible-2ba095f89e22c2b64b1f0a82b826a685dee14c53.tar.gz
aci_rest: Fix ignoring custom port
-rw-r--r--changelogs/fragments/49553-aci_rest-fix-ignoring-custom-port.yaml3
-rw-r--r--lib/ansible/modules/network/aci/aci_rest.py7
2 files changed, 8 insertions, 2 deletions
diff --git a/changelogs/fragments/49553-aci_rest-fix-ignoring-custom-port.yaml b/changelogs/fragments/49553-aci_rest-fix-ignoring-custom-port.yaml
new file mode 100644
index 0000000000..4a9f9ca62d
--- /dev/null
+++ b/changelogs/fragments/49553-aci_rest-fix-ignoring-custom-port.yaml
@@ -0,0 +1,3 @@
+---
+bugfixes:
+- aci_rest - Fix issue ignoring custom port
diff --git a/lib/ansible/modules/network/aci/aci_rest.py b/lib/ansible/modules/network/aci/aci_rest.py
index 39939dceb4..4873278cd0 100644
--- a/lib/ansible/modules/network/aci/aci_rest.py
+++ b/lib/ansible/modules/network/aci/aci_rest.py
@@ -387,8 +387,11 @@ def main():
except Exception as e:
module.fail_json(msg='Failed to parse provided XML payload: %s' % to_text(e), payload=payload)
- # Perform actual request using auth cookie (Same as aci_request, but also supports XML)
- aci.url = '%(protocol)s://%(host)s/' % aci.params + path.lstrip('/')
+ # Perform actual request using auth cookie (Same as aci.request(), but also supports XML)
+ if 'port' in aci.params and aci.params['port'] is not None:
+ aci.url = '%(protocol)s://%(host)s:%(port)s/' % aci.params + path.lstrip('/')
+ else:
+ aci.url = '%(protocol)s://%(host)s/' % aci.params + path.lstrip('/')
if aci.params['method'] != 'get':
path += '?rsp-subtree=modified'
aci.url = update_qsl(aci.url, {'rsp-subtree': 'modified'})