Submitting issue found by @mikewiebe where replaced state does not set a fabric parameter to default if the playbook does not include the parameter (implicit change). In Mike's case, the fabric is initially configured with NTP_SERVER_IP_LIST: <ip_address>. A playbook is then run, with dcnm_fabric task state set to replaced where the task does not include the NTP_SERVER_IP_LIST parameter. In this case, NTP_SERVER_IP_LIST should be set to the default value of "".
Community Note
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
Need to look at the logic in dcnm_fabric/replaced.py for FabricReplacedCommon().update_replaced_payload() The values upon entering this method when the above replaced state playbook is run are:
Since playbook is None the if playbook is None: conditional is entered (see below).
Since default is None, we return None and this is the problem.
We need to check here if controller != default, and return {parameter: default} in this case.
def update_replaced_payload(self, parameter, playbook, controller, default):
if playbook is None:
if default is None:
return None
if controller == default:
return None
if controller is None or controller == "":
return None
return {parameter: default}
if playbook == controller:
return None
return {parameter: playbook}
Summary
Submitting issue found by @mikewiebe where
replaced
state does not set a fabric parameter to default if the playbook does not include the parameter (implicit change). In Mike's case, the fabric is initially configured withNTP_SERVER_IP_LIST: <ip_address>
. A playbook is then run, withdcnm_fabric
task state set toreplaced
where the task does not include theNTP_SERVER_IP_LIST
parameter. In this case,NTP_SERVER_IP_LIST
should be set to the default value of""
.Community Note
Ansible Version and collection version
DCNM version
Affected module(s)
Ansible Playbook
Start with the following fabric.
Then send the following
replaced
state playbook.Debug Output
The problem is understood, so no debugging output is needed.
Expected Behavior
The NTP server configuration for the fabric should be removed.
Actual Behavior
The NTP server configuration is not removed.
Steps to Reproduce
See
Ansible Playbook
section above.References
None
Workaround
Include the fields in the playbook with the changes desired. For example, the following playbook will work to remove the NTP server configuration.
Dev Notes
Need to look at the logic in dcnm_fabric/replaced.py for
FabricReplacedCommon().update_replaced_payload()
The values upon entering this method when the abovereplaced
state playbook is run are:Since
playbook
is None theif playbook is None:
conditional is entered (see below).Since
default
is None, we return None and this is the problem.We need to check here if
controller != default
, and return{parameter: default}
in this case.