mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* 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>
(cherry picked from commit 7359b1fbe5
)
Co-authored-by: spike77453 <spike77453@users.noreply.github.com>
This commit is contained in:
parent
5691e3aff3
commit
0da9d956a0
3 changed files with 9 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- nmcli - compare MAC addresses case insensitively to fix idempotency issue (https://github.com/ansible-collections/community.general/issues/2409).
|
|
@ -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:
|
||||
|
|
|
@ -184,6 +184,7 @@ TESTCASE_BRIDGE = [
|
|||
'ifname': 'br0_non_existant',
|
||||
'ip4': '10.10.10.10/24',
|
||||
'gw4': '10.10.10.1',
|
||||
'mac': '52:54:00:ab:cd:ef',
|
||||
'maxage': 100,
|
||||
'stp': True,
|
||||
'state': 'present',
|
||||
|
@ -200,6 +201,7 @@ ipv4.addresses: 10.10.10.10/24
|
|||
ipv4.gateway: 10.10.10.1
|
||||
ipv4.never-default: no
|
||||
ipv6.method: auto
|
||||
bridge.mac-address: 52:54:00:AB:CD:EF
|
||||
bridge.stp: yes
|
||||
bridge.max-age: 100
|
||||
bridge.ageing-time: 300
|
||||
|
|
Loading…
Reference in a new issue