Bug 1441412

Summary: retiring parent service doesn't retire child service
Product: Red Hat CloudForms Management Engine Reporter: Martin Kourim <mkourim>
Component: AutomateAssignee: abellott
Status: CLOSED CURRENTRELEASE QA Contact: Martin Kourim <mkourim>
Severity: high Docs Contact:
Priority: high    
Version: 5.8.0CC: gmccullo, jhardy, mkanoor, mkourim, obarenbo, simaishi, tfitzger
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: api:rest:services:retirement
Fixed In Version: 5.9.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1496936 (view as bug list) Environment:
Last Closed: 2018-03-06 15:35:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1496936    

Description Martin Kourim 2017-04-11 21:37:17 UTC
Description of problem:
Service has parent service defined ("ancestry": "<parent_id>"). When retiring parent service, child service is not retired.


Version-Release number of selected component (if applicable):
5.8.0.9-alpha2


How reproducible:
Very


Steps to Reproduce:
1. Create two services
POST /api/services
{
  "action": "create",
  "resources": [
    {"name": "test_rest_1", "description": "test service 1"},
    {"name": "test_rest_2", "description": "test service 2"}
  ]
}

2. Make the first service parent to the second service
POST /api/services/:second_service_id
{
  "action": "edit",
  "ancestry": "<first_service_id>"
}

3. Retire the first (parent) service
POST /api/services/:first_service_id
{
  "action": "retire"
}


Actual results:
First service is retired, second service is not retired.


Expected results:
First service is retired, second service is also retired.

Comment 2 Tina Fitzgerald 2017-04-13 14:37:27 UTC
Hi Martin,

Can I access your test appliance?

Thanks,
Tina

Comment 3 Tina Fitzgerald 2017-04-20 20:14:30 UTC
Hi Martin,

Parent and child Service retirement works properly when the services are created through the Admin UI.

UI Test Scenario:
1. Create a service catalog item.
2. Create a service catalog bundle and specify the service catalog item created in step 1 as a resource.
3. Order Service Bundle.
4. Retire Service Bundle. (You'll see that the parent and child service have been retired.)

I think the combination of REST api calls in the example above may need some modifications.  

Were you testing retirement and decided to use the REST api, or were you specifically testing the REST api service functionality? 

Let me know if you have any questions.

Thanks,
Tina

Comment 4 Martin Kourim 2017-04-21 08:33:52 UTC
Hi Tina, I'm specifically testing the REST API functionality.

Comment 5 Tina Fitzgerald 2017-04-24 13:37:08 UTC
Thanks Martin.

Assigning the ticket to Alberto.

Comment 6 abellott 2017-04-24 19:29:00 UTC
Hi Martin,

Setting the parent is not sufficient for wiring the services to properly handling retirement of both, you need to add_resource of the child service onto the parent service.  Although that's not currently possible, it's only for vms/templates.  I'll make an enhancement for that.

For step 2 above, while this works, It's very implementation specific, I'd prefer the parent_service reference:


POST /api/services/:second_service_id
{
  "action": "edit",
  "parent_service": { "href" : "/api/services/:first_service_id" }
}

Comment 7 abellott 2017-04-25 15:01:29 UTC
Hi Martin,

Can you give https://github.com/ManageIQ/manageiq/pull/14876 a try, then attempt the retirement of the parent service.  Thanks.

Alberto

Comment 8 Greg McCullough 2017-09-26 21:24:18 UTC
The enhancement mentioned in comment #6 was implemented in PR https://github.com/ManageIQ/manageiq/pull/15991.

Comment 9 Greg McCullough 2017-09-27 13:12:17 UTC
PR https://github.com/ManageIQ/manageiq/pull/16056 also needed to be back-ported along with PR 15991.

Comment 11 Martin Kourim 2017-10-18 16:03:20 UTC
Verified that retiring parent service also retires child service when the child service was added to parent service using add_resource.