Skip to content

Commit

Permalink
nmcli: fixed idempotency issue when config bridge connection (#6105)
Browse files Browse the repository at this point in the history
* nmcli: fixed idempotency issue when config bridge connection

* Update changelog fragment.

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit 81b16a8)
  • Loading branch information
heaveaxy authored and patchback[bot] committed Mar 26, 2023
1 parent 40e0379 commit de3a2cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/3216-nmcli-bridge-idempotency-fix.yml
Original file line number Diff line number Diff line change
@@ -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).
4 changes: 4 additions & 0 deletions plugins/modules/net_tools/nmcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,10 @@ def connection_options(self, detect_change=False):
'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,
Expand Down

0 comments on commit de3a2cb

Please sign in to comment.