+++ This bug was initially created as a clone of Bug #1416149 +++ Description of problem: Existing or Newly created service added to parent service via REST API or from automation is not visible in UI Version-Release number of selected component (if applicable): 5.7.2.1 How reproducible: 100% Steps to Reproduce: 1. create service 2. create service either via REST API or via that reference the service created in Step 1: POST /api/services { "action" : "create", "resource" : { "name" : "test_servicea", "description" : "Test Service", "parent_service" : { "id" : <id> } } } 3. check U! e 1. Create a service new_service = $evm.vmdb('service').create(:name => "service_a") new_service.display = true 2. Add this service to parent service (service_b) new_service.parent_service = <existing parent service object> 3. check UI. The child service (service_a) is not visible in UI. Additional Info: At database end, relationship of parent, child is showing as expected so it is clear the issue is at UI end. Even after setting the display attribute as true. Still the child service is not visible. #$evm.vmdb('service').all.each do |s| puts s['display'] end; nil -- Showing expected Result #new_service.parent_service ---Showing expected result --- Additional comment from Red Hat Bugzilla Rules Engine on 2017-01-24 12:12:55 EST --- Since this issue was entered in bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release. --- Additional comment from Martin Kourim on 2017-01-26 09:35:23 EST --- Greg McCullough explained to me that it's expected behavior unless the "display" attribute is set to true. However even when the service is created or edited with "display": true, it is not visible in the UI even after the "Reload current display" button is pressed. Only after browser page refresh the child service is visible in UI. --- Additional comment from Martin Kourim on 2017-01-26 12:10:03 EST --- Similarly when the child service that is already visible in UI is deleted using REST API, it remains visible until browser page is refreshed - "Reload current display" button alone will not do. --- Additional comment from Neha Chugh on 2017-04-19 09:11:55 EDT --- Hello Martin, Even refreshing the browser, doesn't display the child service in the UI. Below curl command has been hit in order to reproduce: curl -i -H "Accept: application/json" -X POST -u admin:<passwd> -k -d "{\"action\": \"create\", \"resource\" : { \"name\":\"test_servicea\", \"display\":\"true\",\"parent_service\": {\"id\" : 20000000000002 }}}" https://10.74.130.175/api/services Here, 20000000000002 is a parent ID 10.74.130.175 is cloudforms Appliance URL. You can verify the same in the test Environment 10.74.130.175. Kindly verify and provide the workaround for the same. Regards, Neha Chugh
Hello Greg, Can we have a quick hot fix for this as we are getting frequent cases related to this bug. Regards, Neha Chugh
Neha, Which UI are you referring to? You've stated that it's a problem in the UI and not the API, so would you mind changing the component to either "UI - OPS" or "UI - Service" to reflect that?
Created attachment 1274217 [details] screenshot
I looked at the screenshot in the case (now attached to this BZ), and it appears that this is an issue with the Ops UI not service. Sending to Dan.
To confirm, this service does look totally fine in the console: irb(main):037:0> ericb = $evm.vmdb('service').find_by_name('ericb') => #<MiqAeServiceService:0x62194a8 irb(main):038:0> ericb.direct_service_children => [#<MiqAeServiceService:0x61f6264 @object=#<Service id: 9000000000177, name: "servicename" irb(main):039:0> ericb.direct_service_children[0].display => true irb(main):040:0> ericb.direct_service_children[0].parent_service.name => "ericb" Despite this, as shown in Chris's screenshot above, it doesn't show in the UI.
Dan, It is a purely UI bug, we have confirmed at database level and its working fine. Can we have a quick hotfix for the same as it is getting critical at client end. Regards, Neha Chugh
Neha, Even though parent/child relationship is set, we may be missing the child service resource to the parent, can you give the PR mentioned in 1441412 a try in addition to setting parent and let us know ? Thanks, Alberto
Hello Alberto, I have tried the Edit REST API as suggested in 1441412 i.e. POST /api/services/:second_service_id { "action": "edit", "parent_service": { "href" : "/api/services/:first_service_id" } } Here, I replaced :second_service_id with Child Service ID and :first_service_id replaced by parent service ID. But its throwing me below exception: {"error":{"kind":"internal_server_error","message":"Association named 'parent_service' was not found on Service; perhaps you misspelled it?","klass":"ActiveRecord::AssociationNotFoundError"}} In this thread, I have shared the test appliance where it has been tested. Please try on the same appliance and let me know the recommended way so to get the child service display under parent service. Alberto, please take it on priority as it is getting critical at client end. Regards, Neha Chugh
Hi Neha, I see the issue, the appliance you have is v2.3.0 API, so it's CF 4.2/Euwe release, the code mentioned in the other PR would only apply to upstream master and CF 4.5/Fine if we backport there. that fix depends on many features added to 4.5, enhanced services edit, and the add_resource action. Alberto
Hello Alberto, If I understand the issue correctly, the code has been fixed for CF 4.5/fine and it is recommended to wait till next release as lots of dependencies are associated with it. Can you please confirm if we can backport for CF 4.2/Euwe as a quick workaround, if that is possible it would be great. Regards, Neha Chugh
Hello Alberto, It is getting critical at client end and it would be not feasible to wait till next release, can we have a workaround as it is hampering the productivity. Please let me know the ETA for this as we need to provide hot patch for the same. Regards, Neha Chugh
Dan - I worked through this with Alberto testing against 5.7.1.0 and master and it appears to be a UI issue. You can connect two services together in either automate or the API and set the display flags to true and you never see the child service. The following steps work on 5.7.1 but not on master. Here are the full steps I used to do this in the rails console: # Create handle to access automate service models $evm = MiqAeMethodService::MiqAeService.new(MiqAeEngine::MiqAeWorkspaceRuntime.new) # Create Parent (top-level service is always visible) parent_service = $evm.vmdb('service').create(:name => "service_a") # Create Child and mark as visible child_service = $evm.vmdb('service').create(:name => "service_b") child_service.display = true # Link Services child_service.parent_service = parent_service
*** Bug 1441419 has been marked as a duplicate of this bug. ***
*** Bug 1416149 has been marked as a duplicate of this bug. ***
Verified that service added to parent service via REST API is visible in UI when "display" is set to "true": POST /api/services { "action" : "create", "resource" : { "name" : "test_service01", "description" : "Test Service 01", "display": true } } POST /api/services { "action" : "create", "resource" : { "name" : "test_service02", "description" : "Test Service 02", "parent_service" : { "id" : <test_service01 id> }, "display": true } }