community.network
community.network copied to clipboard
nclu does not commit pending changes when (only) commit: true is provided
SUMMARY
When using the community.network.nclu module with multiple tasks and a final "commit"-task, the commit is not carried out unless that final task also specifically changes the pending configuration (as opposed to earlier tasks).
This used to work but got broken in https://github.com/ansible-collections/community.network/pull/219.
An abridged example:
- name: Configure xyz
nclu:
commands:
add [...]
- name: Configure abc
nclu:
commands:
add [...]
- name: Commit changes
nclu:
commit: True
If either of the first two tasks change any configuration, one would assume that the third task would then commit that configuration. However, since https://github.com/ansible-collections/community.network/pull/219 was pulled in this no longer works -- the commit ONLY happens if there are commands on that task which also change the configuration (an actual change is necessary).
ISSUE TYPE
- Bug Report
COMPONENT NAME
community.network.nclu
ANSIBLE VERSION
ansible [core 2.11.8]
python version = 3.10.2 (main, Feb 4 2022, 12:55:52) [GCC 11.2.1 20211203 (Red Hat 11.2.1-7)]
jinja version = 3.0.3
libyaml = True
(this is verified true on the most current release, as well)
COLLECTION VERSION
Collection Version
----------------- -------
community.network 3.0.0
(this is also the case for 3.1.0)
STEPS TO REPRODUCE
- name: t1
nclu:
commands:
del time ntp source eth0
- name: t2
nclu:
commands:
add time ntp source vlan100
- name: Commit changes
nclu:
commit: True
EXPECTED RESULTS
For the changes in t1 and t2 to be committed.
ACTUAL RESULTS
Changes in t1 and t2 are not committed.
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 @isharacomix @jrrivers click here for bot help