dcnm_image_policy: fix for issue #347 #348
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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