Fedora Account System
Red Hat Associate
Red Hat Customer
Description of problem: Service Item Copy failed for the service items with custom button and custom button set Version-Release number of selected component (if applicable): 5.11.0 How reproducible: Always Steps to Reproduce: 1. Go to Service -> Catalogs -> select catalog item 2. Go to Configurations -> Add a new button group and then add new button under catalog Item. 3. Copy the Service Item and it will be failed with below exception: URL /catalog/tree_autoload Status 500 Internal Server Error Content-Type text/html; charset=utf-8 Data <!DOCTYPE html> <html> <head> <title>We're sorry, but something went wrong (500)</title> <style type="text/css"> body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } div.dialog { width: 25em; padding: 0 4em; margin: 4em auto 0 auto; border: 1px solid #ccc; border-right-color: #999; border-bottom-color: #999; } h1 { font-size: 100%; color: #f00; line-height: 1.5em; } </style> </head> <body> <!-- This file lives in public/500.html --> <div class="dialog"> <h1>We're sorry, but something went wrong.</h1> <p>We've been notified about this issue and we'll take a look at it shortly.</p> </div> </body> </html> Actual results: It is failing to copy the service catalog Item with button and button set. Expected results: It should not be failed. Additional info: This behavior is not seen in for the catalog item copied without button or button set.
Created attachment 1603259 [details] Video of copying service catalog item with button failed
We have a check here: https://github.com/ManageIQ/manageiq-ui-classic/commit/dc22c387e136c76cf51514c71345c60a4e84ac80 that determines whether or not a catalog item can be copied. I'm seeing that none of the items can be copied, I see the message listed in that PR on mouseover of the item that it can't be copied, but the UI still lets me attempt to copy it. I feel like that part is definitely a UI issue.
The UI appears to be hitting https://github.com/ManageIQ/manageiq/blob/master/app/models/mixins/relationship_mixin.rb#L159 and blowing up because some of the custom buttons apparently have multiple parents: [#<Relationship id: 267, resource_type: "CustomButtonSet", resource_id: 35, ancestry: nil, relationship: "membership", created_at: "2019-08-16 11:42:51", updated_at: "2019-08-16 11:42:51">, #<Relationship id: 269, resource_type: "CustomButtonSet", resource_id: 36, ancestry: nil, relationship: "membership", created_at: "2019-08-16 11:42:58", updated_at: "2019-08-16 11:42:58">] for #<CustomButton:0x000055a4019da238> I don't think this has anything to do with service template copying though.
https://github.com/ManageIQ/manageiq-ui-classic/issues/6046 is open for comment 4
https://github.com/ManageIQ/manageiq/pull/19169
New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/6d1b45aa7fd569461bff37e5ae478abb9b7e7aaf commit 6d1b45aa7fd569461bff37e5ae478abb9b7e7aaf Author: d-m-u <drewuhlmann> AuthorDate: Mon Aug 19 15:04:51 2019 -0400 Commit: d-m-u <drewuhlmann> CommitDate: Mon Aug 19 15:04:51 2019 -0400 Fix the set_data info that had links to the original buttons Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1740556 app/models/custom_button_set.rb | 8 +- spec/models/custom_button_set_spec.rb | 3 +- spec/models/service_template/copy_spec.rb | 10 +- 3 files changed, 18 insertions(+), 3 deletions(-)
New commit detected on ManageIQ/manageiq/ivanchuk: https://github.com/ManageIQ/manageiq/commit/c4b2d8aa0425fa12649c7b9a1d772e7da596a98e commit c4b2d8aa0425fa12649c7b9a1d772e7da596a98e Author: Brandon Dunne <bdunne> AuthorDate: Tue Aug 20 13:15:40 2019 -0400 Commit: Brandon Dunne <bdunne> CommitDate: Tue Aug 20 13:15:40 2019 -0400 Merge pull request #19169 from d-m-u/fixing_custom_button_set_copy_children Fix the custom button set set_data hash links to the original buttons on copy (cherry picked from commit 68f281d47fe19f84f0aacff9e8d764d69e315416) https://bugzilla.redhat.com/show_bug.cgi?id=1740556 https://bugzilla.redhat.com/show_bug.cgi?id=1737449 app/models/custom_button_set.rb | 8 +- spec/models/custom_button_set_spec.rb | 3 +- spec/models/service_template/copy_spec.rb | 10 +- 3 files changed, 18 insertions(+), 3 deletions(-)
Yeah, sorry, what? => #<ServiceTemplate id: 2, name: "Copy of test_cat_item", description: "test_cat_item", guid: "d1aa9bde-482e-4500-a598-6058177feb02", type: nil, service_template_id: nil, options: {:button_order=>["cbg-34", "cb-1"]}, created_at: "2019-08-28 07:25:36", updated_at: "2019-08-28 07:25:36", display: false, evm_owner_id: nil, miq_group_id: 2, service_type: "atomic", prov_type: "generic", provision_cost: nil, service_template_catalog_id: 1, long_description: nil, tenant_id: 1, generic_subtype: "custom", deleted_on: nil, internal: false, zone_id: nil, currency_id: nil, price: nil> irb(main):005:0> ServiceTemplate.find(2).custom_buttons => [#<CustomButton id: 2, guid: "ad46658b-d726-4695-8ba9-ba5379f580f7", description: "test_button", applies_to_class: "ServiceTemplate", visibility_expression: nil, options: {:button_icon=>"ff ff-triangle", :button_color=>"#1870da", :button_type=>"default", :display=>true, :open_url=>false, :display_for=>"single", :submit_how=>"one"}, userid: "admin", wait_for_complete: nil, created_on: "2019-08-28 07:25:36", updated_on: "2019-08-28 07:25:36", name: "test_button", visibility: {:roles=>["_ALL_"]}, applies_to_id: 2, enablement_expression: nil, disabled_text: nil>] irb(main):006:0> What's the issue?
I think this is a UI issue since the backend looks fine. Harpreet, can you please take a look? Or clarify how this is supposed to work in the UI?
https://github.com/ManageIQ/manageiq/pull/19227
New commit detected on ManageIQ/manageiq/ivanchuk: https://github.com/ManageIQ/manageiq/commit/02de6c93213ef0dee92e23f46565a523c925cde2 commit 02de6c93213ef0dee92e23f46565a523c925cde2 Author: Greg McCullough <gmccullo> AuthorDate: Tue Sep 3 11:48:54 2019 -0400 Commit: Greg McCullough <gmccullo> CommitDate: Tue Sep 3 11:48:54 2019 -0400 Merge pull request #19227 from d-m-u/fixing_service_template_button_order Update the button order on copy (cherry picked from commit 0780eece232a47f139bebda46772b6cf68618384) https://bugzilla.redhat.com/show_bug.cgi?id=1740556 app/models/custom_button_set.rb | 4 + app/models/service_template/copy.rb | 8 +- spec/models/service_template/copy_spec.rb | 15 +- 3 files changed, 19 insertions(+), 8 deletions(-)