>>> b = Bugzilla(url='https://bugzilla.redhat.com', force_rest=True)
>>> b.getbug(214525300)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/bugzilla/base.py", line 1133, in getbug
extra_fields=extra_fields)
File "/usr/lib/python3.6/site-packages/bugzilla/base.py", line 1123, in _getbug
return self._getbugs([objid], permissive=False, **kwargs)[0]
IndexError: list index out of range
>>> b = Bugzilla(url='https://bugzilla.redhat.com', force_rest=True)
>>> b.getbug(2145254)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/bugzilla/base.py", line 1133, in getbug
extra_fields=extra_fields)
File "/usr/lib/python3.6/site-packages/bugzilla/base.py", line 1123, in _getbug
return self._getbugs([objid], permissive=False, **kwargs)[0]
IndexError: list index out of range
>>> b = Bugzilla(url='https://bugzilla.redhat.com')
>>> b.getbug(214525300)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/base.py", line 1129, in getbug
data = self._getbug(objid,
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/base.py", line 1121, in _getbug
return self._getbugs([objid], permissive=False, **kwargs)[0]
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/base.py", line 1094, in _getbugs
r = self._backend.bug_get(ids, aliases, getbugdata)
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/_backendxmlrpc.py", line 179, in bug_get
return self._xmlrpc_proxy.Bug.get(data)
File "/usr/lib/python3.10/xmlrpc/client.py", line 1122, in __call__
return self.__send(self.__name, args)
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/_backendxmlrpc.py", line 125, in _ServerProxy__request
ret = ServerProxy._ServerProxy__request(
File "/usr/lib/python3.10/xmlrpc/client.py", line 1464, in __request
response = self.__transport.request(
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/_backendxmlrpc.py", line 100, in request
return self.__request_helper(url, request_body)
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/_backendxmlrpc.py", line 47, in __request_helper
return self.parse_response(response)
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/_backendxmlrpc.py", line 84, in parse_response
return unmarshaller.close()
File "/usr/lib/python3.10/xmlrpc/client.py", line 668, in close
raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 101: 'Bug #214525300 does not exist.'>
>>> b.getbug(2145254)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/base.py", line 1129, in getbug
data = self._getbug(objid,
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/base.py", line 1121, in _getbug
return self._getbugs([objid], permissive=False, **kwargs)[0]
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/base.py", line 1094, in _getbugs
r = self._backend.bug_get(ids, aliases, getbugdata)
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/_backendxmlrpc.py", line 179, in bug_get
return self._xmlrpc_proxy.Bug.get(data)
File "/usr/lib/python3.10/xmlrpc/client.py", line 1122, in __call__
return self.__send(self.__name, args)
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/_backendxmlrpc.py", line 125, in _ServerProxy__request
ret = ServerProxy._ServerProxy__request(
File "/usr/lib/python3.10/xmlrpc/client.py", line 1464, in __request
response = self.__transport.request(
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/_backendxmlrpc.py", line 100, in request
return self.__request_helper(url, request_body)
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/_backendxmlrpc.py", line 47, in __request_helper
return self.parse_response(response)
File "/home/andi/virtualenvs/smash/lib/python3.10/site-packages/bugzilla/_backendxmlrpc.py", line 84, in parse_response
return unmarshaller.close()
File "/usr/lib/python3.10/xmlrpc/client.py", line 668, in close
raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 102: 'You are not authorized to access bug #2145254. To see this bug, you must first log in to an account with the appropriate permissions.'>
Problem
When using/enforcing the use of the REST API, the
_getbugmethod raises an IndexError, if1. ID does not exist
2. Not authorized
Preliminary analysis
When using the API route
/rest/bug/<bug_id>one would get appropriate answers from the API (i.e. error 404 and 401), but the_getbugmethod uses the/rest/bugendpoint instead with anidsargument containing a single ID. In this case the API returns an empty list, which seems to be the direct cause of theIndexError.Comparison with XMLRPC
Expected behavior