Bug 1564797 - Cannot Delete DRO
Summary: Cannot Delete DRO
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: UI - OPS
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: GA
: 5.9.3
Assignee: Dan Clarizio
QA Contact: Dave Johnson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-07 23:59 UTC by ldomb
Modified: 2018-04-10 13:59 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 12:42:06 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:


Attachments (Terms of Use)
dro error message (37.44 KB, image/png)
2018-04-07 23:59 UTC, ldomb
no flags Details

Description ldomb 2018-04-07 23:59:52 UTC
Created attachment 1418733 [details]
dro error message

Description of problem:
When creating a dro, I am not able to delte any dros nor the generic object class

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

How reproducible:
100%

Steps to Reproduce:
1. Create a dro class 
2. create an object 
3. try to delete the class

Actual results:
see attachment

Expected results:
dro and class should be deleted

Additional info:

Comment 2 Dave Johnson 2018-04-08 00:04:07 UTC
Please assess the impact of this issue and update the severity accordingly.  Please refer to https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity for a reminder on each severity's definition.

If it's something like a tracker bug where it doesn't matter, please set the severity to Low.

Comment 4 ldomb 2018-04-08 11:58:42 UTC
irb(main):012:0> $evm.vmdb('generic_object_definition').find_by(:name => 'f5bigip')

PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0

PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0

PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0

PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0

=> #<MiqAeServiceGenericObjectDefinition:0x62c5384 @object=#<GenericObjectDefinition id: 99000000000001, name: "f5bigip", description: "Big ip load balancer", properties: {:attributes=>{"poolname"=>:string, "vip"=>:string, "node1"=>:string, "node2"=>:string}, :associations=>{"service"=>"Service", "vm"=>"Vm"}, :methods=>[]}, created_at: "2018-04-07 17:27:46", updated_at: "2018-04-07 17:27:46">, @virtual_columns=["generic_objects_count", "href_slug", "region_description", "region_number"], @associations=[]>

irb(main):013:0> 


generic_object.destroy results in

irb(main):011:0> generic_object.destroy

NoMethodError: PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0

PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0

undefined method `destroy' for #<MiqAeMethodService::MiqAeServiceGenericObjectDefinition:0x0000000aca7ba0>

	from /opt/rh/cfme-gemset/bundler/gems/cfme-automation_engine-ac0e90bcdfeb/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:233:in `method_missing'

	from (irb):11

	from /opt/rh/cfme-gemset/gems/railties-5.0.6/lib/rails/commands/console.rb:65:in `start'

	from /opt/rh/cfme-gemset/gems/railties-5.0.6/lib/rails/commands/console_helper.rb:9:in `start'

	from /opt/rh/cfme-gemset/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:78:in `console'

	from /opt/rh/cfme-gemset/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:49:in `run_command!'

	from /opt/rh/cfme-gemset/gems/railties-5.0.6/lib/rails/commands.rb:18:in `<top (required)>'

	from bin/rails:4:in `require'

	from bin/rails:4:in `<main>'

Comment 5 ldomb 2018-04-08 12:02:07 UTC
Here with correct definitions

irb(main):003:0* generic_object_definition = $evm.vmdb(:generic_object_definition).find_by(:name => 'f5bigip')
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0
=> #<MiqAeServiceGenericObjectDefinition:0x4f8583c @object=#<GenericObjectDefinition id: 99000000000001, name: "f5bigip", description: "Big ip load balancer", properties: {:attributes=>{"poolname"=>:string, "vip"=>:string, "node1"=>:string, "node2"=>:string}, :associations=>{"service"=>"Service", "vm"=>"Vm"}, :methods=>[]}, created_at: "2018-04-07 17:27:46", updated_at: "2018-04-07 17:27:46">, @virtual_columns=["generic_objects_count", "href_slug", "region_description", "region_number"], @associations=[]>
irb(main):004:0> generic_object_definition.inspect_all
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0
=> "#<MiqAeServiceGenericObjectDefinition:0x4f8583c @object=#<GenericObjectDefinition id: 99000000000001, name: \"f5bigip\", description: \"Big ip load balancer\", properties: {:attributes=>{\"poolname\"=>:string, \"vip\"=>:string, \"node1\"=>:string, \"node2\"=>:string}, :associations=>{\"service\"=>\"Service\", \"vm\"=>\"Vm\"}, :methods=>[]}, created_at: \"2018-04-07 17:27:46\", updated_at: \"2018-04-07 17:27:46\">, @virtual_columns=<generic_objects_count: 2, href_slug: \"generic_object_definitions/99000000000001\", region_description: \"Region 99\", region_number: 99>, @associations=[]>"

How do I get rid of the @virtual_columns=<generic_objects_count: 2?

Comment 6 ldomb 2018-04-08 21:47:21 UTC
Ok thanks to Greg I was able to delete the DRO, 

 $evm.vmdb(:generic_object).where(:generic_object_definition => 99000000000001).each {|dro| dro.remove_from_vmdb}

Please keep this open as there is currently no option of deleting the DRO from the UI

Comment 7 Greg McCullough 2018-04-09 14:36:28 UTC
Brad - As I recall not exposing the delete functionality in the UI was by design.  There is no RBAC on these objects which would allow anyone with visibility to this area of the UI to delete them.

Comment 8 Greg McCullough 2018-04-09 17:36:10 UTC
Note: Deleting an instance from automate is supported (see comment #6) as well as from the api through the 'delete' action.

Comment 9 bascar 2018-04-09 17:58:51 UTC
Agreed with comment #7 and comment #8. This can be done as a custom button on the DRO and that can control the access via the service since DRO don't have direct RBAC but the service does. OK to close?

Comment 10 ldomb 2018-04-10 11:40:52 UTC
Yes, can be closed. I think it should be revisited tough, As for a customer, it might not look like it works correctly. There is also no documentation on howto delete it via rest api iirc.

Comment 11 Greg McCullough 2018-04-10 12:42:06 UTC
Thanks, Laurent.  I checked and the documentation in currently in a PR.

PR: https://github.com/ManageIQ/manageiq_docs/pull/676

There's a lot in that PR so more specifically you are looking for: https://github.com/abellotti/manageiq_docs/blob/746d84a86f4e60b5283900d4bfa204c341d999ec/api/reference/generic_objects.adoc#deleting-generic-objects


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