Bug 862523

Summary: Handle non-existent categories gracefully
Product: [Fedora] Fedora Reporter: Petr Šplíchal <psplicha>
Component: python-nitrateAssignee: Petr Šplíchal <psplicha>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ohudlick, psplicha
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-07 18:52:42 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 Petr Šplíchal 2012-10-03 06:52:08 UTC
Description of problem:

python-nitrate should gracefully handle non-existent categories.

Version-Release number of selected component (if applicable):
python-nitrate-0.9-0.el6.noarch

Steps to Reproduce:
>>> print Category(product="RHEL Tests", category="Bad name").id

Actual results:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/nitrate/api.py", line 192, in getter
    self._get()
  File "/usr/lib/python2.6/site-packages/nitrate/api.py", line 657, in _get
    self.name, self.product.id)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.6/site-packages/nitrate/xmlrpc.py", line 127, in request_with_cookies
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response
    return u.close()
  File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: 'DoesNotExist: TestCaseCategory matching query does not exist.'>

Expected results:
NitrateError exception raised.

Comment 1 Petr Šplíchal 2012-12-07 20:03:39 UTC
Fix for this pushed to git:
https://github.com/psss/python-nitrate/commit/cd81ebd

The example above would result in the following traceback:

>>> print Category(product="RHEL Tests", category="Bad name").id
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/nitrate/api.py", line 238, in getter
    self._get()
  File "/usr/lib/python2.6/site-packages/nitrate/api.py", line 752, in _get
    self.name, self.product.name))
nitrate.xmlrpc.NitrateError: Category 'Bad name' not found in 'RHEL Tests'

Comment 2 Fedora Update System 2012-12-10 12:42:03 UTC
python-nitrate-0.9-0.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/python-nitrate-0.9-0.el6

Comment 3 Fedora Update System 2012-12-10 12:48:58 UTC
python-nitrate-0.9-0.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/python-nitrate-0.9-0.fc16

Comment 4 Fedora Update System 2012-12-10 12:48:58 UTC
python-nitrate-0.9-0.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/python-nitrate-0.9-0.fc18

Comment 5 Fedora Update System 2012-12-10 12:49:03 UTC
python-nitrate-0.9-0.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/python-nitrate-0.9-0.fc17

Comment 6 Fedora Update System 2012-12-11 07:47:28 UTC
python-nitrate-0.9-0.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2012-13721/python-nitrate-0.9-0.el6

Comment 7 Fedora Update System 2012-12-19 08:32:59 UTC
python-nitrate-0.9-0.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2012-12-19 08:43:36 UTC
python-nitrate-0.9-0.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2013-01-07 18:52:44 UTC
python-nitrate-0.9-0.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2013-01-12 01:10:07 UTC
python-nitrate-0.9-0.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.