aristanetworks / ansible-cvp

Ansible modules for Arista CloudVision
http://cvp.avd.sh
Apache License 2.0
65 stars 61 forks source link

counter is not incremented for device removals when using CvApiResult/CvManagerResult #628

Closed noredistribution closed 1 year ago

noredistribution commented 1 year ago

Issue Summary

we're doing something like this

>>> my_manager = CvManagerResult(builder_name = 'devices_removed')
>>> my_change = CvApiResult(action_name='leaf1_delete')
>>> my_change.success = True
>>> my_manager.add_change(change = my_change)
2023-Jun-06 12:46:11 IST <DEBUG> response add_change        : receive add_change with %s
>>> my_manager.changes
{'devices_removed_list': ['leaf1_delete'], 'success': True, 'changed': False, 'taskIds': [], 'diff': {}, 'devices_removed_count': 0}
>>>

and devices_removed_count remains 0

instead of also using add_entry which increments the devices_removed_count (in this case) e.g.:


>>> my_change = CvApiResult(action_name='remove_devices')
>>> my_change.add_entry('delete_leaf1')
>>> my_change.add_entry('delete_leaf2')
>>> my_change.add_entry('delete_leaf3')
>>> my_change.success = True
>>> my_manager = CvManagerResult(builder_name = 'devices_removed')
>>> my_manager.add_change(change = my_change)
2023-Jun-06 12:58:31 IST <DEBUG> response add_change        : receive add_change with %s
>>> my_manager.changes
{'devices_removed_list': ['remove_devices'], 'success': True, 'changed': False, 'taskIds': [], 'diff': {}, 'devices_removed_count': 3}
>>>
``

### Which component(s) of AVD impacted

cv_device_v3

### How do you run AVD ?

Ansible CLI (with virtual-env or native python)

### Input variables

_No response_

### Steps to reproduce

_No response_

### Relevant log output

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct