Bug 1595149 - dro.destroy: not removed from service
Summary: dro.destroy: not removed from service
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: GA
: 5.10.0
Assignee: Patrik Kománek
QA Contact: Shveta
URL:
Whiteboard:
Depends On:
Blocks:
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: 5.10.0.4
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-02-07 23:03:14 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:


Attachments (Terms of Use)


Links
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):
5.9.2

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
dro.add_to_service(svc)
3. check the association returns an array with the dro
svc.generic_object
4. destroy the object
dro.destroy
3. check the association returns an array without the dro
svc.generic_object

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 5.10.0.32.20190115185124_c957ada.
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.

https://access.redhat.com/errata/RHSA-2019:0212


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