-
Notifications
You must be signed in to change notification settings - Fork 141
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
Expose error messages from ServiceTemplate.orderable? #656
Expose error messages from ServiceTemplate.orderable? #656
Conversation
@miq-bot add-label enhancement, ivanchuk/yes, wip |
@miq-bot assign @abellotti |
@fdupont-redhat can you look at the failing spec? |
@agrare I think those two test failures are preexisting at the moment and have nothing to do with this code |
Oh it looks like master has been failing for a while... |
Yeah just noticed that @d-m-u thanks |
they're fixed by #662 |
@@ -14,9 +15,10 @@ def order_service_template(id, data, scheduled_time = nil) | |||
|
|||
private | |||
|
|||
def orderable?(service_template) | |||
api_request_allowed? && service_template.orderable? | |||
def validate_order(service_template) |
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.
maybe I'm missing something, but I don't see validate_order, api_request_allowed? or orderable? called from the API.
If they're no longer needed, they should go. though I do have a concern that we're letting go of the logic in api_request_allowed? checking UI calls & Settings.product. wasn't this needed for a fix at some point ?
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.
@abellotti that's an error. I've re-added the check with an error message.
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.
Merci Fabien for the update.
07d0313
to
17e5f6f
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.
Looks okay to me, @abellotti please take a look
Ok, the problem with introducing the validate_<action> method is that it has a special purpose for the API to determine if an action should even be listed in the action list of a resource. So we really cannot have that here, also, validate_<action> should not raise exceptions. Best to put that exception as part of the ordering method. Here's the diff:
|
Checked commits fabiendupont/manageiq-api@d2c94a9~...67c5ce9 with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
Thanks @fdupont-redhat for the fix and update. LGTM!! 👍 |
…in_service_template_orderable Expose error messages from ServiceTemplate.orderable? (cherry picked from commit 2aa1e4c) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1768520
Ivanchuk backport details:
|
This pull request is a follow-up of ManageIQ/manageiq#19186 to accept an array of error messages from
ServiceTemplate.orderable?
, and to display these messages in the response.RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1744197
Depends on: ManageIQ/manageiq#19186