diff --git a/changelogs/fragments/4320-nmcli-hairpin.yml b/changelogs/fragments/4320-nmcli-hairpin.yml new file mode 100644 index 0000000000..bcda97eeaf --- /dev/null +++ b/changelogs/fragments/4320-nmcli-hairpin.yml @@ -0,0 +1,2 @@ +deprecated_features: + - nmcli - deprecate default hairpin mode for a bridge. This so we can change it to ``false`` in community.general 7.0.0, as this is also the default in ``nmcli`` (https://github.com/ansible-collections/community.general/pull/4334). diff --git a/plugins/modules/net_tools/nmcli.py b/plugins/modules/net_tools/nmcli.py index 6a6b3c548f..3c59b7efea 100644 --- a/plugins/modules/net_tools/nmcli.py +++ b/plugins/modules/net_tools/nmcli.py @@ -374,8 +374,9 @@ options: 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. @@ -1376,7 +1377,8 @@ class Nmcli(object): 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'] @@ -1423,6 +1425,18 @@ class Nmcli(object): 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] @@ -2119,7 +2133,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',