Bug 1595149 - dro.destroy: not removed from service
Summary: dro.destroy: not removed from service
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: GA
: 5.10.0
Assignee: Patrik Kománek
QA Contact: Shveta
Depends On:
TreeView+ depends on / blocked
Reported: 2018-06-26 08:49 UTC by Cyril Coupel
Modified: 2019-08-22 00:54 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-02-07 23:03:14 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:0212 None None None 2019-02-07 23:03:24 UTC

Description Cyril Coupel 2018-06-26 08:49:16 UTC
Description of problem:
when calling the destroy method of a generic object (DRO), the object is removed from VMDB but not removed from the linked service.
The service.generic_objects array then have a nil entry wich cause th UI to crash when tryin to display the generic objects of this service.

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

How reproducible:
every times

Steps to Reproduce:
1. create a dro instance:
dro_class = $evm.vmdb(:generic_object_definition).find_by(:name => "demo_dro")
dro = dro_class.create_object(:name => "First Demo DRO",
:is_tired => true,
:created => Time.new,
:retirement => nil)
2. link this object to a service
3. check the association returns an array with the dro
4. destroy the object
3. check the association returns an array without the dro

Actual results:
the svc.generic_object returns [nil]

Expected results:
the svc.generic_object returns []

Additional info:

Comment 2 Greg McCullough 2018-06-26 12:27:06 UTC
Work-around is to remove the generic object from the service before deleting the object using the remove_from_service method.

Patrik - I can see two possible solutions here and both likely make sense to implement.
1. Remove the generic object from all services in a before_destroy callback.
2. Call ".compact" on the services "generic_object" relationship so any nil objects are removed from the return.

Comment 3 Patrik Kománek 2018-07-10 11:33:05 UTC
solved in PR: https://github.com/ManageIQ/manageiq/pull/17679

Comment 5 Shveta 2019-01-18 18:55:13 UTC
Fixed ,
Verified in
The object was also removed from service once the generic object was destroyed .

Comment 6 errata-xmlrpc 2019-02-07 23:03:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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