Bug 968843

Summary: cannot delete a group after jobs have been submitted for it
Product: [Retired] Beaker Reporter: Dan Callaghan <dcallagh>
Component: schedulerAssignee: Amit Saha <asaha>
Status: CLOSED CURRENTRELEASE QA Contact: Nick Coghlan <ncoghlan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: developCC: asaha, dcallagh, ebaak, llim, qwan, rglasz, rmancy
Target Milestone: 0.13   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-25 06:27:03 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:

Description Dan Callaghan 2013-05-30 05:39:34 UTC
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):
beaker-server-0.12.1-1.git.133.6c74a92.el6.noarch


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
    self.main()
  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
    session.commit()
[...]
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-03 02:22:23 UTC
On Gerrit: http://gerrit.beaker-project.org/#/c/2008/

Comment 3 Nick Coghlan 2013-06-06 07:58:59 UTC
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 06:27:03 UTC
Beaker 0.13.1 has been released.