Bug 968843 - cannot delete a group after jobs have been submitted for it
cannot delete a group after jobs have been submitted for it
Product: Beaker
Classification: Community
Component: scheduler (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified (vote)
: 0.13
: ---
Assigned To: Amit Saha
Nick Coghlan
Depends On:
  Show dependency treegraph
Reported: 2013-05-30 01:39 EDT by Dan Callaghan
Modified: 2018-02-05 19:41 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-06-25 02:27:03 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Dan Callaghan 2013-05-30 01:39:34 EDT
Description of problem:
Beaker returns a 500 if you try to delete a group after jobs have been submitted for it.

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

Steps to Reproduce:
1. Create a group
2. Submit a job for the group
3. Try to remove the group (Admin -> Groups, click Remove)

Actual results:
Beaker returns a 500.
2013-05-30 05:32:41,180 cherrypy.msg INFO HTTP: Page handler: <bound method Groups.remove of <bkr.server.group.Groups object at 0x7fed4eedba90>>
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/CherryPy-2.3.0-py2.6.egg/cherrypy/_cphttptools.py", line 121, in _run
  File "/usr/lib/python2.6/site-packages/CherryPy-2.3.0-py2.6.egg/cherrypy/_cphttptools.py", line 264, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in remove
  File "/usr/lib/python2.6/site-packages/turbogears/identity/conditions.py", line 249, in require
    return fn(self, *args, **kwargs)
  File "<string>", line 3, in remove
  File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 361, in expose
    *args, **kw)
  File "<generated code>", line 0, in run_with_transaction
  File "/usr/lib/python2.6/site-packages/peak/rules/core.py", line 153, in __call__
    return self.body(*args, **kw)
  File "/usr/lib/python2.6/site-packages/turbogears/database.py", line 463, in sa_rwt
IntegrityError: (IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`beaker_devel`.`job`, CONSTRAINT `job_group_id_fk` FOREIGN KEY (`group_id`) REFERENCES `tg_group` (`group_id`))') 'DELETE FROM tg_group WHERE tg_group.group_id = %s' (14L,)

Expected results:
Not sure... at least a friendly error message. The Remove link shouldn't appear either, if the removal is going to be disallowed.

It's probably not practical to allow the deletion in this case, since it would affect completed job rows which is never supposed to happen. We have declared in the past that systems cannot be deleted for the same reason.
Comment 1 Amit Saha 2013-06-02 22:22:23 EDT
On Gerrit: http://gerrit.beaker-project.org/#/c/2008/
Comment 3 Nick Coghlan 2013-06-06 03:58:59 EDT
Confirmed this works as expected on the integration instance:

1. Ran a job on behalf of a group
2. Attempted to remove that group
3. Received a notification the group could not be deleted due to associated jobs
Comment 5 Amit Saha 2013-06-25 02:27:03 EDT
Beaker 0.13.1 has been released.

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