Bug 1370399 - The message is no meaningful when delete a nonexistent system via CLI
Summary: The message is no meaningful when delete a nonexistent system via CLI
Alias: None
Product: Beaker
Classification: Community
Component: command line
Version: 23
Hardware: Unspecified
OS: Unspecified
low vote
Target Milestone: 24.0
Assignee: Hui Wang
QA Contact: Dan Callaghan
Depends On:
TreeView+ depends on / blocked
Reported: 2016-08-26 08:22 UTC by Hui Wang
Modified: 2017-02-21 18:50 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2017-02-21 18:50:53 UTC

Attachments (Terms of Use)

Description Hui Wang 2016-08-26 08:22:35 UTC
Description of problem:
When I delete a nonexistent system, it will give no meaningful message: NoResultFound: No row was found for one()

Version-Release number of selected component (if applicable):
Beaker 24.0.git.37.717f87f 

How reproducible:

Steps to Reproduce:
1.In client to delete a nonexistent system
$bkr system-delete $nonexistent_system

Actual results:
XML-RPC fault: <class 'sqlalchemy.orm.exc.NoResultFound'>:No row was found for one()

Expected results:
Give the meaningful message, like:
Sorry, there is no system named $nonexistent_system. Pls add it first.

Additional info:

bkr.server.xmlrpccontroller ERROR Error handling XML-RPC method
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/bkr/server/xmlrpccontroller.py", line 53, in RPC2
response = self.process_rpc(method,params)
File "/usr/lib/python2.6/site-packages/bkr/server/xmlrpccontroller.py", line 42, in process_rpc
response = obj(*params)
File "<string>", line 3, in delete
File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 356, in expose
*args, **kw)
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 "<string>", line 2, in delete
File "/usr/lib/python2.6/site-packages/bkr/server/identity.py", line 288, in require
Areturn func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/bkr/server/systems.py", line 92, in delete
system = System.by_fqdn(fqdn, identity.current.user)
File "/usr/lib/python2.6/site-packages/bkr/server/model/inventory.py", line 740, in by_fqdn
return System.all(user).filter(System.fqdn == fqdn).one()
File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/query.py", line 2329, in one
raise orm_exc.NoResultFound("No row was found for one()")
NoResultFound: No row was found for one()

Comment 1 Hui Wang 2016-08-26 08:46:56 UTC
tests patch: https://gerrit.beaker-project.org/#/c/5158/

Comment 2 Roman Joost 2016-08-30 00:04:07 UTC
Sorry - my mistake of taken the patch as the fix.

Comment 3 Hui Wang 2016-09-01 08:09:48 UTC
(In reply to Roman Joost from comment #2)
> Sorry - my mistake of taken the patch as the fix.

Hi Roman, 
I try to fix this issue. So you can assign this bug to me.

Sophia Wang

Comment 4 Hui Wang 2016-09-02 05:39:29 UTC
fix patch: https://gerrit.beaker-project.org/#/c/5158/

Comment 6 Dan Callaghan 2016-09-06 01:02:12 UTC

$ bkr system-delete idonotexist
XML-RPC fault: <class 'bkr.server.bexceptions.DatabaseLookupError'>:System idonotexist does not exist

We could also consider adding some handling for DatabaseLookupError in xmlrpccontroller.py to make this fault message slightly cleaner -- but it's not a big deal. I would rather just port that bkr command to use the JSON interface instead.

Comment 7 Dan Callaghan 2017-02-21 18:50:53 UTC
Beaker 24.0 has been released.

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