However, there's a simple workaround for this. Generate a query URL using the bugzilla web UI, and pass it to /usr/bin/bugzilla like:
bugzilla query --from-url "$url"
That's it! Then you can tweak the output as you want using --outputformat or similar. This also works for savedsearch URLs as well.
So, say I go to the bugzilla web UI and say 'show me all open, upstream libvirt bugs that haven't received a comment in since 2013'. It generates a massive URL. Here's what the URL looks like:
https://bugzilla.redhat.com/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=POST&bug_status=MODIFIED&bug_status=ON_DEV&bug_status=ON_QA&bug_status=VERIFIED&bug_status=RELEASE_PENDING&classification=Community&component=libvirt&f1=longdesc&list_id=2372821&n1=1&o1=changedafter&product=Virtualization%20Tools&query_format=advanced&v1=2013-12-31Just pass that that thing as $url in the above command, and you should see the same results as the web search (if your results aren't the same, you might need to do 'bugzilla login' first to cache credentials).
This is also easy to do via the python API:
#!/usr/bin/python import bugzilla bzapi = bugzilla.Bugzilla("bugzilla.redhat.com") buglist = bzapi.query(bzapi.url_to_query("URL")) for bug in buglist: print bug.summary ....
The caveat: as of now this only works with bugzilla.redhat.com, which has an API extension that allows it to interpret the URL syntax as regular query parameters. My understanding is that this may be available upstream at some point, so other bugzilla instances will benefit as well.
On a related note - I use a script like this[1] (heavily borrowed from rwmj's libguestfs bugs script) which will generate a report like that[2] displaying bugs in three categories: (1) NEW, ASSIGNED, ON_DEV (2) MODIFIED, POST, ON_QA (3) VERIFIED
ReplyDelete[1] https://github.com/kashyapc/rdo-bug-query/blob/master/query-all-rdo-bugs.sh
[2] http://kashyapc.fedorapeople.org/virt/openstack/bugzilla/rdo-bug-status/all-rdo-bugs-20-05-2014.txt
Try to copy the example given above and i still don't get the bugs summary from the link provided
ReplyDeleteThe code example has a typo, it should be bug.query not bug.search. But after that it works for me. If you are hitting issues, please file a github issue with full code and URL example you are using. Depending on the query it may not be working if you aren't signed into bugzilla. Better to check this code example and the comments for more explanation: https://github.com/python-bugzilla/python-bugzilla/blob/master/examples/query.py
Delete