Bug 978225

Summary: Show 500 error when trying to delete the same group twice
Product: [Retired] Beaker Reporter: xjia <xjia>
Component: web UIAssignee: Amit Saha <asaha>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 0.13CC: aigao, asaha, dcallagh, ebaak, jingwang, qwan, rmancy, tools-bugs, xma, xtian
Target Milestone: 0.17   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-10 23:28:16 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:
Bug Depends On:    
Bug Blocks: 974893    

Description xjia 2013-06-26 06:43:02 UTC
Description of problem:
Create a group named "test", and open two web-page to show group list. And on page 1, delete group "test". Then on page 2, delete group "test" again. 

==> /var/log/beaker/server-debug.log <==
2013-06-26 06:39:26,668 cherrypy.msg INFO HTTP: Page handler: <bound method Groups.inner of <bkr.server.group.Groups object at 0x7f831eee1350>>
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 inner
  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 inner
  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 458, in sa_rwt
    retval = func(*args, **kw)
  File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 244, in _expose
    @abstract()
  File "<generated code>", line 0, in _expose
  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/controllers.py", line 390, in <lambda>
    fragment, options, args, kw)))
  File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 425, in _execute_func
    output = errorhandling.try_call(func, *args, **kw)
  File "/usr/lib/python2.6/site-packages/turbogears/errorhandling.py", line 77, in try_call
    return func(self, *args, **kw)
  File "/usr/lib/python2.6/site-packages/bkr/server/controller_utilities.py", line 362, in inner
    return fn(*args, **kw)
  File "/usr/lib/python2.6/site-packages/bkr/server/group.py", line 665, in remove
    group = Group.by_id(kw['group_id'])
  File "/usr/lib/python2.6/site-packages/bkr/server/model.py", line 1823, in by_id
    return cls.query.filter_by(group_id=id).one()
  File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/query.py", line 1684, in one
    raise orm_exc.NoResultFound("No row was found for one()")
NoResultFound: No row was found for one()



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

How reproducible:
100%

Steps to Reproduce:
1.Create group named "test"
2.Open two page show group list
3.Page 1:Delete group "test"
4.Page 2:Delete group "test"

Actual results:
Show 500 error

Expected results:
The group doesn't exist or something.

Additional info:

Comment 1 Nick Coghlan 2013-06-26 06:54:13 UTC
Once the by_name() methods at the model layer are generating a more specific exception, the UI could catch those and report them more appropriately rather than failing with a 500 error.

Comment 2 Amit Saha 2014-05-29 11:01:25 UTC
Patch: http://gerrit.beaker-project.org/#/c/3117/

Also, removing the dependency on bug 974893 (and making that dependent instead on this), since I am tackling these "common" bugs in a bottom up manner. I will be fixing these specific reported bugs first and then whatever is left will fix them as part of the fix to bug 974893

Comment 5 Dan Callaghan 2014-06-10 23:28:16 UTC
Beaker 0.17.0 has been released.