Don't return a duplicate object from MiqGroup#settings #16572
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.
Commit c0a662b made the return value of
MiqGroup#settings
aHashWithIndifferentAccess
. Unfortunately,Hash#with_indifferent_access
returns a duplicate object.This behavior breaks callers when they attempt to alter the settings hash in-place, for example:
https://github.com/ManageIQ/manageiq-ui-classic/blob/7d2ef009ac536770b1415ee59fa79c3a01e4d53e/app/controllers/report_controller/menus.rb#L230-L231
This PR changes the
#settings
method to also set the settings attribute so that it returns the same instance as is set for the group object. Additionally thesettings=
method had to be changed so that we are consistent with the new type in the column.This has the same net effect as a data migration and a serialization type change to
ActiveSupport::HashWithIndifferentAccess
. I'm okay with either route./cc @yrudman @skateman
https://bugzilla.redhat.com/show_bug.cgi?id=1516793