From d0b18215467ce71105f0acde8a5e0f31eb438f20 Mon Sep 17 00:00:00 2001 From: Jonathan Kamens Date: Thu, 27 Oct 2022 23:25:34 -0400 Subject: [PATCH] Convert the current value of wifi.wake-on-wlan to a format we understand The new value of wifi.wake-on-wlan is specified as an integer, but in the nmcli output it's specified as a hex string followed by a textual description of it. Therefore, to determine properly whether it's being changed we need to pull the hex string out of the current value, convert it into an integer, and finally convert the integer back to a string so that we can compare it to the new specified value. Without this change, whenever wifi.wake-on-wlan is specified in the module arguments the module will think the value is being changed even when it isn't. --- plugins/modules/net_tools/nmcli.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/modules/net_tools/nmcli.py b/plugins/modules/net_tools/nmcli.py index a2518578f09..f35a2fea190 100644 --- a/plugins/modules/net_tools/nmcli.py +++ b/plugins/modules/net_tools/nmcli.py @@ -2105,6 +2105,12 @@ def _compare_conn_params(self, conn_info, options): if key in conn_info: current_value = conn_info[key] + if key in ('wifi.wake-on-wlan', + '802-11-wireless.wake-on-wlan') and \ + current_value is not None: + match = re.match('0x([0-9A-Fa-f]+)', current_value) + if match: + current_value = str(int(match.group(1), 16)) if key in ('ipv4.routes', 'ipv6.routes') and current_value is not None: current_value = self.get_route_params(current_value) if key == self.mac_setting: