Bug 1294470

Summary: Error message does not help end-user "Cannot delete record because of dependent hosts"
Product: Red Hat Satellite Reporter: Peter Vreman <peter.vreman>
Component: Content ManagementAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED NOTABUG QA Contact: Katello QA List <katello-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1.5CC: peter.vreman, pmoravec
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-18 08:28:42 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:
Bug Depends On:    
Bug Blocks: 1122832    

Description Peter Vreman 2015-12-28 11:28:59 UTC
Description of problem:
I have the error to delete a Content View. The error message is too generic to help the end user to solve the problem.
Please extend the error message with details of the list dependent hosts that are preventing the deletion.

Action:

Actions::Katello::ContentView::Destroy

Input:

{"content_view"=>
  {"id"=>96,
   "name"=>"hg-crash::Infra::IPSWeb",
   "label"=>"hg-crash__Infra__IPSWeb"},
 "organization"=>{"id"=>3, "name"=>"Hilti", "label"=>"Hilti"},
 "remote_user"=>"hoici-53fba4ca",
 "remote_cp_user"=>"hoici",
 "locale"=>"en"}

Output:

{}

Exception:

ActiveRecord::DeleteRestrictionError: Cannot delete record because of dependent hosts

Backtrace:

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/associations/builder/has_many.rb:63:in `block in define_restrict_dependency_method'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:517:in `_run__341289337038255713__destroy__217011182686457229__callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_destroy_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/callbacks.rb:254:in `destroy'

This does not

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


How reproducible:


Steps to Reproduce:
1. Delete content view that has dependent hosts
2.
3.

Actual results:
Unspecified error

Expected results:
Details on the error which hosts are preventing the deletion


Additional info:

Comment 1 Pavel Moravec 2016-02-03 13:30:00 UTC
Setting #c0 private since it has customer name.

Comment 2 Pavel Moravec 2016-02-03 13:33:39 UTC
(In reply to Pavel Moravec from comment #1)
> Setting #c0 private since it has customer name.

Ah, I havent checked who reported the bug, reverting the change, sorry :)

Anyway this has been fixed in ruby193-rubygem-katello-2.2.0.81-1.el7sat.noarch / Satellite 6.1.6 I have (maybe sooner, not sure what 6.1.z upstaed this package).

Now production.log and also any error string has something like:

2016-02-03 14:24:28 [E] RuntimeError: Cannot delete 'cv_2' due to associated environments: Library. Cannot delete 'cv_2' due to associated systems: pmoravec-rhel6.gsslab.brq.redhat.com.


Please check if it works as expected.

Comment 3 Peter Vreman 2016-02-18 08:28:42 UTC
Closing. I cannot reproduce it anymore. I now always get the error message mentioned in Comment 2.
I expect my situation at that time was the result of other failures.