Bug 1444043 - Existing or Newly created service added to parent service via REST API or from automation is not visible in UI
Summary: Existing or Newly created service added to parent service via REST API or fro...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: UI - OPS
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.9.0
Assignee: lgalis
QA Contact: Martin Kourim
URL:
Whiteboard: api:rest:service
: 1416149 1441419 (view as bug list)
Depends On: 1416149
Blocks: 1451827 1459977
TreeView+ depends on / blocked
 
Reported: 2017-04-20 13:21 UTC by Neha Chugh
Modified: 2020-09-10 10:29 UTC (History)
20 users (show)

Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1416149
: 1451827 1459977 (view as bug list)
Environment:
Last Closed: 2018-03-06 15:03:53 UTC
Category: Bug
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
screenshot (8.83 KB, image/png)
2017-04-26 13:26 UTC, Chris Kacerguis
no flags Details

Description Neha Chugh 2017-04-20 13:21:29 UTC
+++ 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

Comment 3 Neha Chugh 2017-04-25 10:03:07 UTC
Hello Greg,

Can we have a quick hot fix for this as we are getting frequent cases related to this bug.

Regards,
Neha Chugh

Comment 4 Tim Wade 2017-04-25 16:51:43 UTC
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?

Comment 5 Chris Kacerguis 2017-04-26 13:26:43 UTC
Created attachment 1274217 [details]
screenshot

Comment 6 Chris Kacerguis 2017-04-26 13:27:05 UTC
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.

Comment 7 Henry Grover 2017-04-26 18:25:13 UTC
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.

Comment 8 Neha Chugh 2017-04-28 05:17:28 UTC
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

Comment 9 Neha Chugh 2017-04-28 05:17:46 UTC
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

Comment 11 abellott 2017-04-28 15:28:43 UTC
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

Comment 12 Neha Chugh 2017-05-03 11:30:20 UTC
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

Comment 15 abellott 2017-05-03 14:52:44 UTC
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

Comment 16 Neha Chugh 2017-05-08 12:48:13 UTC
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

Comment 17 Neha Chugh 2017-05-08 12:48:25 UTC
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

Comment 18 Neha Chugh 2017-05-12 10:12:21 UTC
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

Comment 19 Neha Chugh 2017-05-12 10:12:36 UTC
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

Comment 21 Greg McCullough 2017-05-12 20:06:26 UTC
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

Comment 27 lgalis 2017-05-16 21:32:34 UTC
*** Bug 1441419 has been marked as a duplicate of this bug. ***

Comment 41 lgalis 2017-06-15 02:31:06 UTC
*** Bug 1416149 has been marked as a duplicate of this bug. ***

Comment 42 Martin Kourim 2017-10-24 11:44:36 UTC
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
  }
}


Note You need to log in before you can comment on or make changes to this bug.