-
Notifications
You must be signed in to change notification settings - Fork 897
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
Allow error messages in ServiceTemplate.validate_order #19186
Allow error messages in ServiceTemplate.validate_order #19186
Conversation
@miq-bot add-label enhancement, ivanchuk/yes, wip |
Seems reasonable to me, though I'm wondering why this isn't a bonafide validation on the model somewhere. |
Some of the template errors get stored in |
@d-m-u, yes they could be added. That's another way of validating something, with a different output type. Maybe in another PR ? |
@fdupont-redhat this looks like it might be better to have a |
0c14431
to
3267d93
Compare
app/models/service_template.rb
Outdated
@@ -353,7 +356,7 @@ def validate_template | |||
end | |||
|
|||
def validate_order | |||
service_template_catalog && display | |||
supports_order? |
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.
This could probably just be another alias right?
Like
alias orderable? supports_order?
alias validate_order supports_order?
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.
Good point.
This looks good @fdupont-redhat just the one comment |
Checked commits fabiendupont/manageiq@d59a445~...e941a51 with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
unsupported_reason_add(:order, 'All VMs of the migration plan have already been successfully migrated') if unmigrated_vms.blank? | ||
end | ||
alias orderable? supports_order? | ||
alias validate_order supports_order? |
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.
Hm I'm surprised you needed the alias in the parent and child classes
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.
think alias_method in the parent class would have fixed this
…s_in_service_template_orderable Allow error messages in ServiceTemplate.validate_order
…s_in_service_template_orderable Allow error messages in ServiceTemplate.validate_order (cherry picked from commit 7b2880c) https://bugzilla.redhat.com/show_bug.cgi?id=1768520
Ivanchuk backport details:
|
@ghost Cannot add the following reviewer because they are not recognized: d-m-u |
For V2V, we want to return a meaningful message to the user when the service isn't orderable.
In current implementation, the
ServiceTemplate.validate_order
method only returns a boolean.This PR makes it return explicit error messages. The error messages are aggregated with the
workflow.validate_dialog
error messages, so the user has more information why the service template order has failed.This requires a follow-up PR in ManageIQ/manageiq-api, because it expects a boolean, and also to add the error messages to the response.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1744197
Depends on #19203
see also ManageIQ/manageiq-api#656