From e1f828cc1c5c17056e210b7bb39aafd850281660 Mon Sep 17 00:00:00 2001 From: Sam Potekhin Date: Sun, 26 Feb 2023 22:24:14 +0700 Subject: [PATCH 1/3] nmcli: fixed idempotency issue with 'may_fail4' when 'method' is 'disabled' * added note to documentation --- .../fragments/0000-nmcli-ipv4-mayfail-idempotency-fix.yml | 2 ++ plugins/modules/nmcli.py | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 changelogs/fragments/0000-nmcli-ipv4-mayfail-idempotency-fix.yml diff --git a/changelogs/fragments/0000-nmcli-ipv4-mayfail-idempotency-fix.yml b/changelogs/fragments/0000-nmcli-ipv4-mayfail-idempotency-fix.yml new file mode 100644 index 00000000000..66116265361 --- /dev/null +++ b/changelogs/fragments/0000-nmcli-ipv4-mayfail-idempotency-fix.yml @@ -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' (PR_HERE). diff --git a/plugins/modules/nmcli.py b/plugins/modules/nmcli.py index 461bcc58f95..c617acdc8da 100644 --- a/plugins/modules/nmcli.py +++ b/plugins/modules/nmcli.py @@ -197,6 +197,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 @@ -1576,6 +1577,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: From 1d76f30fb971dbff2c46d0baa0a22542c04fcef1 Mon Sep 17 00:00:00 2001 From: Sam Potekhin Date: Sun, 26 Feb 2023 23:50:28 +0700 Subject: [PATCH 2/3] updated changelog fragment --- ...ency-fix.yml => 6106-nmcli-ipv4-mayfail-idempotency-fix.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename changelogs/fragments/{0000-nmcli-ipv4-mayfail-idempotency-fix.yml => 6106-nmcli-ipv4-mayfail-idempotency-fix.yml} (52%) diff --git a/changelogs/fragments/0000-nmcli-ipv4-mayfail-idempotency-fix.yml b/changelogs/fragments/6106-nmcli-ipv4-mayfail-idempotency-fix.yml similarity index 52% rename from changelogs/fragments/0000-nmcli-ipv4-mayfail-idempotency-fix.yml rename to changelogs/fragments/6106-nmcli-ipv4-mayfail-idempotency-fix.yml index 66116265361..f37435fdc65 100644 --- a/changelogs/fragments/0000-nmcli-ipv4-mayfail-idempotency-fix.yml +++ b/changelogs/fragments/6106-nmcli-ipv4-mayfail-idempotency-fix.yml @@ -1,2 +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' (PR_HERE). + - 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). From 739c0dfa71d49f816e7801699f344ce06b8a0ea8 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 25 Mar 2023 08:25:24 +0100 Subject: [PATCH 3/3] Update changelog fragment. --- .../fragments/6106-nmcli-ipv4-mayfail-idempotency-fix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/fragments/6106-nmcli-ipv4-mayfail-idempotency-fix.yml b/changelogs/fragments/6106-nmcli-ipv4-mayfail-idempotency-fix.yml index f37435fdc65..a444176155a 100644 --- a/changelogs/fragments/6106-nmcli-ipv4-mayfail-idempotency-fix.yml +++ b/changelogs/fragments/6106-nmcli-ipv4-mayfail-idempotency-fix.yml @@ -1,2 +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). + - 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).