Skip to content

Commit

Permalink
nmcli: fixed idempotency issue with 'may_fail4' when 'method' is 'dis…
Browse files Browse the repository at this point in the history
…abled' (#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 <[email protected]>
(cherry picked from commit 5ee6870)
  • Loading branch information
heaveaxy authored and patchback[bot] committed Mar 26, 2023
1 parent 40e0379 commit c0399d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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).
5 changes: 5 additions & 0 deletions plugins/modules/net_tools/nmcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
may_fail4:
description:
- 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
default: true
version_added: 3.3.0
Expand Down Expand Up @@ -1569,6 +1570,10 @@ def connection_options(self, detect_change=False):
'ipv6.ip6-privacy': self.ip_privacy6,
'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.
if self.mac:
Expand Down

0 comments on commit c0399d8

Please sign in to comment.