-
Notifications
You must be signed in to change notification settings - Fork 987
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
Fixes #34206 - Fix bool params in global registration template #9010
Conversation
Issues: #34206 |
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.
I wonder if @param
should be normalized in code instead. For example, on line 151 @force
is also used but not checked with == 'true'
. So it will be inconsistent. Please at least make it consistent, but consider normalizing @force
before passing it to the template.
0062cb6
to
74c932b
Compare
Condition on 151th line updated. I was thinking about normalizing parameters before passing them to the template, but with extensions from plugins (Katello & REX) it would require quite a lot of changes in foreman core and in the plugins. Updating the global reg. template looks like the easiest fix. |
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.
Slowly starting to get back and I now remembered we also have host_param_true?()
which uses Foreman::Cast.to_bool(value)
. However, I'm not sure if it works since it's really only valid for host params. Do you think this could be used?
I'm worried about the case where it's passed via the API and actually might be a real boolean. Both are specified as real booleans in https://github.com/Katello/katello/blob/8ca9d36efa44b8f2fa0982b066e7483989407fec/app/controllers/katello/concerns/api/v2/registration_commands_controller_extensions.rb#L33-L34 and this patch may cause a regression there.
This is for generating registration command, not for the |
Since the workflow wasn't clear, I had to figure this out myself. Noting it down here for others. What happens is that a Foreman plugin can declare foreman/app/registries/foreman/plugin.rb Lines 609 to 611 in 5bbd164
These allowed params are gathered in the controller: foreman/app/controllers/concerns/foreman/controller/registration.rb Lines 13 to 15 in 5bbd164
The registration controller then filters the
To properly cast to a bool it would need to modify An alternative would be to introduce a macro to do the comparison. Thinking more about it: perhaps Having said that, I think this could be OK to go in but I don't want to merge while our test suite is broken. Hopefully #9012 solves that. |
I thought the same, see #9013 |
@stejskalleos can you rebase pls, the failures should be fixed |
74c932b
to
8dc9d00
Compare
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.
Thanks!
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.
Thanks @stejskalleos ! 👍
CP 3.1: 5cb4f6c |
No description provided.