(MODULES-6714) - inifile: ensure absent not working with refreshonly = true #313
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.
Solution:
Check for events before executing create, destroy or value update
Added acceptance tests for events
Problem description:
When removing a setting in a section with refreshonly set to true the setting is not completely removed. Only the value is removed.
Expect to remove the setting.
What happened:
refreshonly was added specifically to refresh a value when there's an event that triggers a notification that is why the setting didn't get removed although the destroy method was triggered before the refreshonly (which only added back the setting with an empty value, because of this line:
provider.value = self[:value] if self[:refreshonly]and because the manifest which was supposed to remove the setting had no value defined, thus the empty string )Upon further investigation even if an event was being triggered or not, the ini_setting manifest was going be executed. This is why I added the insync? method inside the ensurable block, we want to listen for an event if we're using refreshonly attribute, and only then execute, the manifest.