Closed ewenmcneill closed 3 months ago
Closing issue to clean up my list of "open issues created", since after two years with no reply at all from Dell I assume this is probably never going to be fixed (even though the original report, above, included a work around).
Ewen
ETA: apologies for the duplicate notifications; the only close option available to end users is "close with comment" and I seem to have missed it twice, so I deleted those comments and made a new one for the closing.
SUMMARY
Changes to config nested more than one parent down (eg,
interface
/vrrp-group
) shows as "always changed" even if config lines present, because the parsed config is returned with a fixed indent level of 1.ISSUE TYPE
COMPONENT NAME
dellemc.os10.plugins.module_utils.network.os10.py
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Ansible host is CentOS 7, with Ansible 2.10 installed from PIP (last version supported by Python 3.6 in CentOS 7). Target switch is DellEMC S5248F-ON, running 10.5.4.0.98.
STEPS TO REPRODUCE
Given a layer 3 vlan interface with a VRRP group on it
and the setup step:
EXPECTED RESULTS
On the second run of applying the configuration for vlan 99, I expect it to show as "ok", as it has already been configured.
ACTUAL RESULTS
Instead on every run of applying the configuration for vlan 99, the
vrrp-group
task step is shown as changed. Every run, forever. Even though the correct configuration is on the switch.With some "
q
" debugging, I narrowed that down to the code that handles reconstituting the configuration section to compare:https://github.com/ansible-collections/dellemc.os10/blob/d343550a5e7dc0bef2f4bae96274087329dbc28a/plugins/module_utils/network/os10.py#L128-L146
not properly handling configuration indented more than one level deep. In particular the configuration is returned as
str
values, and the code assumes after outputting a single line everything else should be idented by exactly 1:https://github.com/ansible-collections/dellemc.os10/blob/d343550a5e7dc0bef2f4bae96274087329dbc28a/plugins/module_utils/network/os10.py#L143
When there is more than one parent (indicating more than one level of nesting) this is incorrect; there should be one level of identing per parent.
I was able to work around this with the following replacement for
get_sublevel_config()
, which properly counts the number of indents required by the parents:Once the correct indent level was returned the already configured
vlan99
vrrp-group
configuration then returnedok
as expected, both in "dry run" mode and in actual apply changes mode.And if the vlan99
vrrp-group
config was manually removed, it was correctly reapplied by Ansible, and then on the subsequent runs correctly showed as "ok". (Both with justvirtual-address
manually removed, and then on another test with the wholevrrp-group
manually removed.)FTR, I found that the parsed config extracted was always
str
(ie, without indent built in) for thevirtual-address
command that should have been nested two deep; possibly whoever wrote the code was assuming it would beConfigLine
, but that does not appear to always be the case.