Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nmcli: Change hairpin default mode #4334

Merged
merged 5 commits into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/4320-nmcli-hairpin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecated_features:
- nmcli - deprecate default hairpin mode for a bridge. This so we can change it to ``no`` in community.general 7.0.0, as this is also the default in nmcli.
dupondje marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 17 additions & 3 deletions plugins/modules/net_tools/nmcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,9 @@
description:
- This is only used with 'bridge-slave' - 'hairpin mode' for the slave, which allows frames to be sent back out through the slave the
frame was received on.
- The default value is C(true), but that is being deprecated
and it will be changed to C(false) in community.general 7.0.0.
type: bool
default: yes
runner:
description:
- This is the type of device or network connection that you wish to create for a team.
Expand Down Expand Up @@ -1294,7 +1295,8 @@ def __init__(self, module):
self.hellotime = module.params['hellotime']
self.maxage = module.params['maxage']
self.ageingtime = module.params['ageingtime']
self.hairpin = module.params['hairpin']
# hairpin should be back to normal in 7.0.0
self._hairpin = module.params['hairpin']
self.path_cost = module.params['path_cost']
self.mac = module.params['mac']
self.runner = module.params['runner']
Expand Down Expand Up @@ -1341,6 +1343,18 @@ def __init__(self, module):

self.edit_commands = []

@property
def hairpin(self):
if self._hairpin is None:
self.module.deprecate(
"Parameter 'hairpin' default value will change from true to false in community.general 7.0.0. "
"Set the value explicitly to supress this warning.",
version='7.0.0', collection_name='community.general',
)
# Should be False in 7.0.0 but then that should be in argument_specs
self._hairpin = True
return self._hairpin

def execute_command(self, cmd, use_unsafe_shell=False, data=None):
if isinstance(cmd, list):
cmd = [to_text(item) for item in cmd]
Expand Down Expand Up @@ -1983,7 +1997,7 @@ def main():
hellotime=dict(type='int', default=2),
maxage=dict(type='int', default=20),
ageingtime=dict(type='int', default=300),
hairpin=dict(type='bool', default=True),
hairpin=dict(type='bool'),
path_cost=dict(type='int', default=100),
# team specific vars
runner=dict(type='str', default='roundrobin',
Expand Down