Skip to content

Commit

Permalink
Convert the current value of wifi.wake-on-wlan to a format we understand
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jikamens committed Oct 28, 2022
1 parent 8125409 commit d0b1821
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/modules/net_tools/nmcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d0b1821

Please sign in to comment.