MetricsGrimoire / Bicho

Bicho is a command line based tool used to parse bug/issue tracking systems
http://metricsgrimoire.github.com/Bicho/
GNU General Public License v2.0
68 stars 30 forks source link

Error when bug is not found (404) #127

Closed dicortazar closed 10 years ago

dicortazar commented 10 years ago

Example when retrieving this issue: https://api.launchpad.net/1.0/fuel/+bug/1298369

Launchpad returns: "Object: <Product at 0x2b0e6e0fdbd0>, name: u'1298369'"

[13:50:32] /usr/local/bin/bicho --db-user-out=xxxx --db-password-out=xxxx --db-database-out=xxxx -d 1 -b lp -u https://bugs.launchpad.net/openstack -g -l Checking URL: https://bugs.launchpad.net DBG: [15/Apr/2014-13:50:33] Bicho object created, options and backend initialized Running Bicho with delay of 1 seconds DBG: [15/Apr/2014-13:50:33] https://bugs.launchpad.net/openstack DBG: [15/Apr/2014-13:50:38] Last bug already cached: 2014-04-09 08:19:42 DBG: [15/Apr/2014-13:50:38] https://bugs.launchpad.net/fuel/+bug/1297866 updated at 2014-04-09T08:20:27.909165+00:00 Error in function analyzeBug with URL: ' 'https://bugs.launchpad.net/openstack and Bug: https://api.launchpad.net/1.0/fuel/+bug/1297866 Traceback (most recent call last): File "/usr/local/bin/bicho", line 25, in retval = bicho.main.main() File "/usr/local/lib/python2.7/dist-packages/bicho/main.py", line 56, in main backend.run() File "/usr/local/lib/python2.7/dist-packages/bicho/backends/lp.py", line 1014, in run issue_data = self.analyze_bug(bug) File "/usr/local/lib/python2.7/dist-packages/bicho/backends/lp.py", line 850, in analyze_bug unicode(bug.bug.duplicate_of.id)) File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/resource.py", line 688, in getattr return super(Entry, self).getattr(name) File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/resource.py", line 331, in getattr return self.lp_get_parameter(attr) File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/resource.py", line 215, in lp_get_parameter self._ensure_representation() File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/resource.py", line 357, in _ensure_representation representation = self._root._browser.get(self._wadl_resource) File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/_browser.py", line 291, in get response, content = self._request(url, extra_headers=headers) File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/_browser.py", line 281, in _request raise error lazr.restfulclient.errors.NotFound: HTTP Error 404: Not Found

Response headers:

-content-encoding: gzip content-length: 80 content-type: text/plain date: Tue, 15 Apr 2014 11:39:51 GMT server: zope.server.http (HTTP) status: 404 vary: Accept-Encoding

x-powered-by: Zope (www.zope.org), Python (www.python.org)

Response body:

Object: <lp.systemhomes.MaloneApplication object at 0x8cb5d50>, name: u'1298369'

sduenas commented 10 years ago

The problem here is 1297866 issue has a duplicate issue, 1298369, which is private. When trying to retrieve the information from this one, it raises the error.

I didn't find any way to know whether an issue is private or not, so a try/except block should fix the problem.