Bugzilla Automation with perl — add, update or query any bug in Bugzilla using perl and www series modules for perl.

Today I was trying to do some queries and see if I could create a new bug or update a existing bug in the Bugzilla. The one that I was trying to access was on version 2.0 and not on 3.0. This being the case, the XMLRPC interface was not working properly and to top it all, I was wanted to query quite a lot of bugs. So, I went out to evaluate how to avoid the manual work and get this done faster. Here\’s some of my findings:

Note: If you have direct access to the bugzilla database, dont bother with any of these, simplest is to directly query the database 🙂

There is a Bugzilla client for windows called MyZilla. This is a freeware, but I ran into problems running this with wine and did not bother to debug the same.

There is a python plugin to use bugzilla. The package name in Fedora for the same is \”python-bugzilla.noarch\”. You can install this with

sudo yum install python-bugzilla.noarch

This uses the XML-RPC interface to talk to the bugzilla. So not of much use for me. But this is quite powerful tool. The man page for the tool is available here.

Lets try perl now to do what we want to. Let take a simple example using the perl mechanize module (taken from here):


use WWW::Mechanize;

my $link = \”https://x.x/bt/query.cgi?GoAheadAndLogIn=1\”;

my $login = \”x\\@gx.com\”;

my $pass = \”xx\”;

my $mech = WWW::Mechanize->new();

$mech->agent_alias( \’Windows IE 6\’ );

$mech->get( $link );

my %login = ( \”Bugzilla_login\”=> $login,

\”Bugzilla_password\”=> $pass);


$mech->click( \’GoAheadAndLogIn\’ );

Now, thats a pretty neat script. That will allow me to login to the Bugzilla account. But I still need to do some investigation and spend some time to execute my query and get the result. Haaaaaaaaa.. Am I the first one to think about this. NO. There is a perl module \”perl-WWW-Bugzilla.noarch\”. This module provides some funtionality to add and update the bugs in bugzilla. If you look at the pm files for the module you will get enough hint to enter a new bug or update an existing bug. You can install this with :

sudo yum install perl-WWW-Bugzilla.noarch

There is a module \”perl-Fedora-Bugzilla\”, which is more useful for the Fedora Bugzilla. This also uses the XML-RPC interface and \”Fedora\’s Bugzilla implementation has a large number of custom methods.  This module aims to expose them, in a kinder, gentler way.\” So, still no luck.

Let\’s get back to basic\’s before we go any further. Lets try to do it with wget and shell and perl scripts.

Lets create a file with the list of bugs (each in seperate line) and call it list. And then execute the following:

for i in `cat list`; do wget$i -O $i -o temp;  echo -n \”$i\” ;cat $i  |egrep \’Summary|Product\’| awk -F\’;\’ \'{printf \”\\t%s\\t\”,$2}\’; echo ;done

This will print the result neatly as

Bug ID         Product               Headline

and also save all the details of the bugs in individual files with Bug ID as the file name. Quite near, but need more to do for the execution of query. I still need the bug id\’s for this to work.

Let\’s now try to use a perl script with shell script called buglist. The script and readme are available here. The readme and the scripts are quite descriptive and you need to do minimal amount of chages to make this work. So finally I settled with this one with the changes required for my work. Hope this helps you when you are stuck with something in Bugzilla.

7 thoughts on “Bugzilla Automation with perl — add, update or query any bug in Bugzilla using perl and www series modules for perl.”

  1. Hi,
    I need to create some automation scripts in Perl for both Solaris and Windows platform.

    This scripts will do unattended installation of different applications. Once the installer is kicked off, the installer asks different questions (like, what is the install dir?, what is the port #?, etc) and the user needs to type those input on the screen. I also need to send the output of the execution in a text file.

    And probably at the end, it might need some string extraction and comparison to make sure that the installation was successful or not.

    Do you have any sample script of this kind?

    Thanks a lot,

  2. Hi,

    I dont have any sample script of this kind and sorry that I could not help you in writing one as I am keeping very busy currently, But I suggest that you can look at any Makefile.pl that comes with cpan modules. That should give you a starting point.


  3. Hi – It’s good to find such cool stuff on the Web as I have been able to fiind here. I agree with most of what is written here and I’ll be returning to this website again. Thanks again for posting such great reading material!

  4. Pingback: shoes

This site uses Akismet to reduce spam. Learn how your comment data is processed.