Bug 1022461

Summary: 500 error when remove some Power Type
Product: [Retired] Beaker Reporter: wangjing <jingwang>
Component: web UIAssignee: Roman Joost <rjoost>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 0.15CC: aigao, dcallagh, dgallowa, dowang, ebaak, qwan, rjoost, tools-bugs, xtian
Target Milestone: 22.0Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-14 05:34:06 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:

Comment 3 Raymond Mancy 2013-10-24 00:33:36 UTC
Yes, I can't imagine it's ever OK to delete a power type when it is still being used. Obviously we need to handle this situation better than with an ISE.

This page is mostly useful for adding power types, as rarely would we want to delete power types I'm guessing. Maybe we don't even need this page.

Comment 4 Nick Coghlan 2013-10-25 00:59:23 UTC
As Ray notes, we should be reporting something like "cannot remove power type that is still in use" or equivalent. Alternatively, we may need to switch to the "hidden" rather than "deleted" approach to power types as well (since Removed systems may still reference an otherwise no longer needed power type)

Comment 5 Dan Callaghan 2015-03-10 00:42:21 UTC
*** Bug 1199920 has been marked as a duplicate of this bug. ***

Comment 6 David Galloway 2015-05-07 19:45:25 UTC
(In reply to Nick Coghlan from comment #4)
> As Ray notes, we should be reporting something like "cannot remove power
> type that is still in use" or equivalent. Alternatively, we may need to
> switch to the "hidden" rather than "deleted" approach to power types as well
> (since Removed systems may still reference an otherwise no longer needed
> power type)

+1 for the "hidden" vs "deleted" approach.  We're just trying to clean up the power type dropdown and I ran into this bug trying to delete a power type that is only used by Removed systems.

This bug is still present in Beaker v20.0.

Comment 7 Roman Joost 2015-08-27 06:26:50 UTC
I'll implement the "hidden" approach as stated by Nick. Dan mentioned in naming terms it would be good to track the deletion with a "delete" column.

Comment 8 Roman Joost 2015-08-28 00:31:47 UTC
After careful thinking we've come to the conclusion that setting the power type to just "deleted" is a bit pointless due to the fact that is just a 'label' with one column.

The plan is now:
(1) port all the existing TG grid stuff to a simple page with a list-group and Create and Delete buttons,
(2) return a nicer error message if the power type is already referenced,
(3) The deletion of a power type should create an entry in the activity log
(4) (optional) add some UI which pre-checks if a power type is referenced and gives the user a modal saying: "This power type is used by <x> systems, etc"

Comment 9 Roman Joost 2015-09-14 04:34:26 UTC
Sorry, forgot to add a link to the gerrit patch:

https://gerrit.beaker-project.org/#/c/4372/

Comment 10 Roman Joost 2015-09-14 04:39:59 UTC
(In reply to David Galloway from comment #6)
> (In reply to Nick Coghlan from comment #4)
> > As Ray notes, we should be reporting something like "cannot remove power
> > type that is still in use" or equivalent. Alternatively, we may need to
> > switch to the "hidden" rather than "deleted" approach to power types as well
> > (since Removed systems may still reference an otherwise no longer needed
> > power type)
> 
> +1 for the "hidden" vs "deleted" approach.  We're just trying to clean up
> the power type dropdown and I ran into this bug trying to delete a power
> type that is only used by Removed systems.
> 
> This bug is still present in Beaker v20.0.

Unfortunately this bug fix won't be a solution for this situation unfortunately. The command line tool doesn't provide a designated command as well. The current best work around we can off is searching for old systems which use the power type* and then manually clear their power settings.

* Using a command like: bkr system-list --xml-filter '<powertype value="something"/>'

Comment 13 Dan Callaghan 2016-01-14 05:34:06 UTC
Beaker 22.0 has been released.