From 3432be3a2faffa01ff68fadead4cab822afb5142 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sun, 26 Mar 2023 09:48:29 +0200 Subject: [PATCH] [PR #6105/81b16a88 backport][stable-6] nmcli: fixed idempotency issue when config bridge connection (#6243) nmcli: fixed idempotency issue when config bridge connection (#6105) * nmcli: fixed idempotency issue when config bridge connection * Update changelog fragment. --------- Co-authored-by: Felix Fontein (cherry picked from commit 81b16a88ee4d8e2433dca7f323e22bca2d37c6ac) Co-authored-by: Sam Potekhin --- changelogs/fragments/3216-nmcli-bridge-idempotency-fix.yml | 2 ++ plugins/modules/nmcli.py | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 changelogs/fragments/3216-nmcli-bridge-idempotency-fix.yml diff --git a/changelogs/fragments/3216-nmcli-bridge-idempotency-fix.yml b/changelogs/fragments/3216-nmcli-bridge-idempotency-fix.yml new file mode 100644 index 0000000000..130800b6da --- /dev/null +++ b/changelogs/fragments/3216-nmcli-bridge-idempotency-fix.yml @@ -0,0 +1,2 @@ +bugfixes: + - nmcli - fixed idempotency issue for bridge connections. Module forced default value of ``bridge.priority`` to nmcli if not set; if ``bridge.stp`` is disabled nmcli ignores it and keep default (https://github.com/ansible-collections/community.general/issues/3216, https://github.com/ansible-collections/community.general/issues/4683). diff --git a/plugins/modules/nmcli.py b/plugins/modules/nmcli.py index 0a9eff8da1..d967ddd446 100644 --- a/plugins/modules/nmcli.py +++ b/plugins/modules/nmcli.py @@ -1629,6 +1629,10 @@ class Nmcli(object): 'bridge.priority': self.priority, 'bridge.stp': self.stp, }) + # priority make sense when stp enabed, otherwise nmcli keeps bridge-priority to 32768 regrdless of input. + # force ignoring to save idempotency + if self.stp: + options.update({'bridge.priority': self.priority}) elif self.type == 'team': options.update({ 'team.runner': self.runner,