-
Notifications
You must be signed in to change notification settings - Fork 900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accept non symbol values from settings #17168
Accept non symbol values from settings #17168
Conversation
Accept non symbol values from settings. With recent API change, we are getting symbols transformed to strings. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1558031
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - would be nice if there were a trivial test in here
I have no problem with this, however we use symbols in a lot of places within settings though so I'm curious if there is a more general fix that can be done here /cc @abellotti |
@agrare right, so this fixes failing refreshes in several providers. If @abellotti has a fix that would not turn Symbol into the String, that might be the best. Since there are plenty Symbol values in settings, we are not sure what everything broke. |
I also started going down this path with another setting, but closed the PR after a discussion with @Fryguy where we came to the same conclusion: The API shouldn't be putting strings where we expect symbols. |
ok, https://bugzilla.redhat.com/show_bug.cgi?id=1558031 back to API. @agrare or do you think we should still merge this? OpenShift refresh will remain broken until this is fixed and the settings values need to be put back to symbol. Closing for now ... |
I do feel using symbols vs strings in some values was an arbitrary choice we made that doesn't add any value (pun not intended), and we better stop doing that. Surprisingly, it seems we have very few of these!
It might be cleaner to normalize to symbols where we read these Settings instead of deeper code using it, like here. I'm ok with both. |
What we really care about is not just symbols, it's whether it's safe to round-trip settings as JSON.
OK, so we also have some dates in azure, doesn't sound hard to take strings there. Overall, way smaller problem than I feared, IMHO worth doing. |
I agree with @cben in that the backend should be made to deal with values that are Strings, as we will likely remove symbols as possible values due to JSON roundtripping. |
@Ladas I've reopened this. |
Checked commit Ladas@2d04511 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
yeah, it makes sense not to require symbol |
@Ladas Thinking about this, I think the code should be doing to_s instead of to_s. The reason is that they may put non-string values such as integers or nil (invalid, yes), and .to_sym on those will blow up. |
@Fryguy I'm thinking you meant this?
I think the code should be doing
👍 I feel we should remove symbols from our public interface (JSON) and |
I t's really a very edge case. Like, if someone accidentally typed The way this should be fixed is to introduced a validator method so the person making changes to the config can't even set the wrong values in the first place. It would be nice if providers could bring their own pluggable config validators. |
Symbols in configuration values are problematic because Symbols do not roundtrip through JSON. Since the API now exposes Settings, it's not possible to set Symbols as values. The saver_strategy was fixed in ManageIQ/manageiq#17168 to support String values, and the next step is to remove all Symbols from the Settings. ManageIQ/manageiq#17201 https://bugzilla.redhat.com/show_bug.cgi?id=1558031
Symbols in configuration values are problematic because Symbols do not roundtrip through JSON. Since the API now exposes Settings, it's not possible to set Symbols as values. The saver_strategy was fixed in ManageIQ/manageiq#17168 to support String values, and the next step is to remove all Symbols from the Settings. ManageIQ/manageiq#17201 https://bugzilla.redhat.com/show_bug.cgi?id=1558031
Symbols in configuration values are problematic because Symbols do not roundtrip through JSON. Since the API now exposes Settings, it's not possible to set Symbols as values. The saver_strategy was fixed in ManageIQ/manageiq#17168 to support String values, and the next step is to remove all Symbols from the Settings. ManageIQ/manageiq#17201 https://bugzilla.redhat.com/show_bug.cgi?id=1558031
Symbols in configuration values are problematic because Symbols do not roundtrip through JSON. Since the API now exposes Settings, it's not possible to set Symbols as values. The saver_strategy was fixed in ManageIQ/manageiq#17168 to support String values, and the next step is to remove all Symbols from the Settings. ManageIQ/manageiq#17201 https://bugzilla.redhat.com/show_bug.cgi?id=1558031
roundtrip through JSON. Since the API now exposes Settings, it's not possible to set Symbols as values. The saver_strategy was fixed in ManageIQ/manageiq#17168 to support String values, and the next step is to remove all Symbols from the Settings. ManageIQ/manageiq#17201 https://bugzilla.redhat.com/show_bug.cgi?id=1558031 673b088
roundtrip through JSON. Since the API now exposes Settings, it's not possible to set Symbols as values. The saver_strategy was fixed in ManageIQ/manageiq#17168 to support String values, and the next step is to remove all Symbols from the Settings. ManageIQ/manageiq#17201 https://bugzilla.redhat.com/show_bug.cgi?id=1558031
Symbols in configuration values are problematic because Symbols do not roundtrip through JSON. Since the API now exposes Settings, it's not possible to set Symbols as values. The saver_strategy was fixed in ManageIQ/manageiq#17168 to support String values, and the next step is to remove all Symbols from the Settings. ManageIQ/manageiq#17201 https://bugzilla.redhat.com/show_bug.cgi?id=1558031
@simaishi Can we start backporting these PRs — this one has to go in first — to gaprindashvili? I've reopened the BZ because full round-trip of settings via API still breaks some other settings, including a new case for regexps we're not sure how to solve (#17201 (comment), #18208 (comment)). |
@cben The BZ referenced in this PR isn't approved to be included in 5.9.z releases, so I'm not able to backport at this time... |
Accept non symbol values from settings. With recent API change,
we are getting symbols transformed to strings.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1558031