The dcnm_image_policy module was not handling overridden state correctly.
It was correctly deleting image policies that were not in the playbook, but it was merging image policy configurations from the playbook with the image policy configurations on the controller. It should have been REPLACING these configurations.
Fix
This PR addresses this by modifying the Overridden() class within dcnm_image_policy.py to call Replaced().commit() rather than Merged().commit().
No changes are required for unit tests since the individual support modules are all doing what they are supposed to do. The only issue here was that dcnm_image_policy.py (main module) was instantiating, and calling commit() on, the wrong class.
Other changes
Updated dcnm_image_policy integration test.
a. For overridden state, added a packages dictionary to the created image policy's configuration (this adds packageName and rpmimages to the image policy).
b. Added verifications that the task for overridden state removes packageName and rpmimages from the image policy.
c. Updated asserts for metadata to verify that metadata.action is "replace" rather than "update"
Summary
The
dcnm_image_policy
module was not handlingoverridden
state correctly.It was correctly deleting image policies that were not in the playbook, but it was merging image policy configurations from the playbook with the image policy configurations on the controller. It should have been REPLACING these configurations.
Fix
This PR addresses this by modifying the
Overridden()
class withindcnm_image_policy.py
to callReplaced().commit()
rather thanMerged().commit()
.No changes are required for unit tests since the individual support modules are all doing what they are supposed to do. The only issue here was that
dcnm_image_policy.py
(main module) was instantiating, and callingcommit()
on, the wrong class.Other changes
dcnm_image_policy
integration test.a. For
overridden
state, added apackages
dictionary to the created image policy's configuration (this addspackageName
andrpmimages
to the image policy).b. Added verifications that the task for
overridden
state removespackageName
andrpmimages
from the image policy.c. Updated asserts for
metadata
to verify thatmetadata.action
is "replace" rather than "update"Closes
Closes issue #347