1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[PR #6106/5ee68704 backport][stable-6] nmcli: fixed idempotency issue with 'may_fail4' when 'method' is 'disabled' (#6241)

nmcli: fixed idempotency issue with 'may_fail4' when 'method' is 'disabled' (#6106)

* nmcli: fixed idempotency issue with 'may_fail4' when 'method' is 'disabled'

* added note to documentation

* updated changelog fragment

* Update changelog fragment.

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 5ee687049f)

Co-authored-by: Sam Potekhin <heaveaxy@gmail.com>
This commit is contained in:
patchback[bot] 2023-03-26 09:45:57 +02:00 committed by GitHub
parent 9cd3f37686
commit 8a0b7dcdc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- nmcli - fixed idempotency issue when module params is set to ``may_fail4=false`` and ``method4=disabled``; in this case nmcli ignores change and keeps their own default value ``yes`` (https://github.com/ansible-collections/community.general/pull/6106).

View file

@ -197,6 +197,7 @@ options:
may_fail4: may_fail4:
description: description:
- If you need I(ip4) configured before C(network-online.target) is reached, set this option to C(false). - If you need I(ip4) configured before C(network-online.target) is reached, set this option to C(false).
- This option applies when C(method4) is not C(disabled).
type: bool type: bool
default: true default: true
version_added: 3.3.0 version_added: 3.3.0
@ -1576,6 +1577,10 @@ class Nmcli(object):
'ipv6.ip6-privacy': self.ip_privacy6, 'ipv6.ip6-privacy': self.ip_privacy6,
'ipv6.addr-gen-mode': self.addr_gen_mode6 'ipv6.addr-gen-mode': self.addr_gen_mode6
}) })
# when 'method' is disabled the 'may_fail' no make sense but accepted by nmcli with keeping 'yes'
# force ignoring to save idempotency
if self.ipv4_method and self.ipv4_method != 'disabled':
options.update({'ipv4.may-fail': self.may_fail4})
# Layer 2 options. # Layer 2 options.
if self.mac: if self.mac: