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

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
This commit is contained in:
Jiří Stránský 2019-02-06 17:51:30 +01:00 committed by ansibot
parent f9f7b29a5a
commit 0924a8cf67

View file

@ -185,7 +185,7 @@ def main():
if nat_destination: if nat_destination:
nat_floating_addrs = [addr for addr in server.addresses.get( nat_floating_addrs = [addr for addr in server.addresses.get(
cloud.get_network(nat_destination)['name'], []) cloud.get_network(nat_destination)['name'], [])
if addr.addr == public_ip and if addr['addr'] == public_ip and
addr['OS-EXT-IPS:type'] == 'floating'] addr['OS-EXT-IPS:type'] == 'floating']
if len(nat_floating_addrs) == 0: if len(nat_floating_addrs) == 0: