mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
nmcli: Compare MAC addresses case insensitively (#2416)
* nmcli: Compare MAC addresses case insensitively * Update changelogs/fragments/2416-nmcli_compare_mac_addresses_case_insensitively.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nmcli.py Co-authored-by: Felix Fontein <felix@fontein.de> * Add mac to TESTCASE_BRIDGE so test_bridge_connection_unchanged covers case sensitive mac address comparison * Update plugins/modules/net_tools/nmcli.py Co-authored-by: Felix Fontein <felix@fontein.de> * Convert current_value to uppercase as well in case nmcli changes behaviour Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
b5f8ae4320
commit
7359b1fbe5
3 changed files with 9 additions and 1 deletions
|
@ -1042,7 +1042,6 @@ class Nmcli(object):
|
|||
'con-name': 'connection.id',
|
||||
'autoconnect': 'connection.autoconnect',
|
||||
'ifname': 'connection.interface-name',
|
||||
'mac': self.mac_setting,
|
||||
'master': 'connection.master',
|
||||
'slave-type': 'connection.slave-type',
|
||||
'zone': 'connection.zone',
|
||||
|
@ -1066,6 +1065,11 @@ class Nmcli(object):
|
|||
current_value = [re.sub(r'^{\s*ip\s*=\s*([^, ]+),\s*nh\s*=\s*([^} ]+),\s*mt\s*=\s*([^} ]+)\s*}', r'\1 \2 \3',
|
||||
route) for route in current_value]
|
||||
current_value = [re.sub(r'^{\s*ip\s*=\s*([^, ]+),\s*nh\s*=\s*([^} ]+)\s*}', r'\1 \2', route) for route in current_value]
|
||||
if key == self.mac_setting:
|
||||
# MAC addresses are case insensitive, nmcli always reports them in uppercase
|
||||
value = value.upper()
|
||||
# ensure current_value is also converted to uppercase in case nmcli changes behaviour
|
||||
current_value = current_value.upper()
|
||||
elif key in param_alias:
|
||||
real_key = param_alias[key]
|
||||
if real_key in conn_info:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue