From 94ed95c8b61dfe0979d8cf284b2c2eb6ef9a008e Mon Sep 17 00:00:00 2001 From: Simon Hensel Date: Mon, 10 Jul 2023 15:14:02 +0200 Subject: [PATCH] Fix port_security_enabled key for port module Changes to the port_security_enabled parameter are not applied due to mismatching key names. In the port module, the input parameter is called `port_security_enabled`, while the OpenStackSDK is using a field called `is_port_security_enabled`. When updating an existing port, the port module is comparing the dictionary keys of the Ansible module parameters with those of the port object returned by the OpenStackSDK. Since these keys different, they will not match and changes to port security are not applied. Story: 2010687 Task: 47789 Change-Id: I838e9d6ebf1a281269add91724eac240abe35fd4 --- plugins/modules/port.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/modules/port.py b/plugins/modules/port.py index 123fab27..65e3b4cc 100644 --- a/plugins/modules/port.py +++ b/plugins/modules/port.py @@ -138,10 +138,11 @@ options: of I(no_security_groups): C(true)." type: bool default: 'false' - port_security_enabled: + is_port_security_enabled: description: - Whether to enable or disable the port security on the network. type: bool + aliases: ['port_security_enabled'] security_groups: description: - Security group(s) ID(s) or name(s) associated with the port. @@ -479,7 +480,7 @@ class PortModule(OpenStackModule): name=dict(required=True), network=dict(), no_security_groups=dict(default=False, type='bool'), - port_security_enabled=dict(type='bool'), + is_port_security_enabled=dict(type='bool', aliases=['port_security_enabled']), security_groups=dict(type='list', elements='str'), state=dict(default='present', choices=['absent', 'present']), ) @@ -655,7 +656,7 @@ class PortModule(OpenStackModule): 'extra_dhcp_opts', 'is_admin_state_up', 'mac_address', - 'port_security_enabled', + 'is_port_security_enabled', 'fixed_ips', 'name']: if self.params[k] is not None: