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.
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)
*** Bug 1199920 has been marked as a duplicate of this bug. ***
(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.
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.
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"
Sorry, forgot to add a link to the gerrit patch: https://gerrit.beaker-project.org/#/c/4372/
(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"/>'
Beaker 22.0 has been released.