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):
Steps to Reproduce:
1.In client to delete a nonexistent system
$bkr system-delete $nonexistent_system
XML-RPC fault: <class 'sqlalchemy.orm.exc.NoResultFound'>:No row was found for one()
Give the meaningful message, like:
Sorry, there is no system named $nonexistent_system. Pls add it first.
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
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()
tests patch: https://gerrit.beaker-project.org/#/c/5158/
Sorry - my mistake of taken the patch as the fix.
(In reply to Roman Joost from comment #2)
> Sorry - my mistake of taken the patch as the fix.
I try to fix this issue. So you can assign this bug to me.
fix patch: https://gerrit.beaker-project.org/#/c/5158/
$ 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.
Beaker 24.0 has been released.