Open sjpb opened 1 year ago
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
cc @alcamie101 click here for bot help
I'm also seeing this issue using ansible [core 2.13.3] with community.general version 7.5.0 on RHEL 8.7
A work around seems to be to set the mode from it's default value of "balance-rr" to the correct mode of the interface using an ansible fact as below:
community.general.nmcli:
conn_name: "bond0"
mode: "{{ ansible_facts['bond0']['mode'] }}"
routes4: '10.0.0.1/32 10.0.0.254'
state: present
Is there a better fix for this issue?
Looking at plugins/modules/nmcli.py it would appear the issue is caused by the default value of "mode". In Nmcli.connection_options() if the connection type is "bond" then "mode" will always be added as a command line argument. So if mode is not included when calling the module and the actual mode of the bond is not "balance-rr" it will cause an error. A simple solution would be not to have a default for mode but this will break any playbook expecting the default value!
Yes, simply removing the default would be a breaking change. Removing it needs a longer deprecation period where not specifying a default will keep the current behavior, but emit a deprecation warning.
A deprecation period sounds like the simplest plan of action. In the mean time I have removed the default setting in plugins/modules/nmcli.py of my local copy:
mode=dict(type='str', default='balance-rr',
choices=['802.3ad', 'active-backup', 'balance-alb', 'balance-rr', 'balance-tlb', 'balance-xor', 'broadcast']),
to
mode=dict(type='str',
choices=['802.3ad', 'active-backup', 'balance-alb', 'balance-rr', 'balance-tlb', 'balance-xor', 'broadcast']),
What sort of timescale is usually acceptable for the deprecation period?
For such changes I would use ~2 major versions, so that users have ~one year to adjust.
This works for me. :) So we are looking at a fix to be implimented at the end of 2024?
Someone would have to start implementing the deprecation first, otherwise nothing will change anytime soon.
Also it would be good that the deprecation already includes the code to switch to, potentially allowing to enable it with a switch (a new option).
Summary
Adding a route to a bonded interface fails.
Issue Type
Bug Report
Component Name
nmcli
Ansible Version
Community.general Version
Configuration
OS / Environment
RockyLinux 8.7
Steps to Reproduce
Expected Results
Route to get added
Actual Results
Note that doing this manually works (and better, doesn't require me to specify the connection type):
Code of Conduct