From 0924a8cf678909d04195a1b3dd5856145b03bace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Str=C3=A1nsk=C3=BD?= Date: Wed, 6 Feb 2019 17:51:30 +0100 Subject: [PATCH] Fix dictionary access in os_floating_ip module (#51444) When using `nat_destination` parameter of `os_floating_ip` module, dot syntax (`addr.addr`) is used to access a value in a dictionary, resulting in the module crashing with this error: AttributeError: 'dict' object has no attribute 'addr' This is now fixed, when using correct syntax (`addr['addr']`), the module seems to work fine. Fixes #51443 --- lib/ansible/modules/cloud/openstack/os_floating_ip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/openstack/os_floating_ip.py b/lib/ansible/modules/cloud/openstack/os_floating_ip.py index ef95c4d9b0..c1e1a46e97 100644 --- a/lib/ansible/modules/cloud/openstack/os_floating_ip.py +++ b/lib/ansible/modules/cloud/openstack/os_floating_ip.py @@ -185,7 +185,7 @@ def main(): if nat_destination: nat_floating_addrs = [addr for addr in server.addresses.get( cloud.get_network(nat_destination)['name'], []) - if addr.addr == public_ip and + if addr['addr'] == public_ip and addr['OS-EXT-IPS:type'] == 'floating'] if len(nat_floating_addrs) == 0: