API to change milestones

Tosh, Michael J michael.j.tosh at lmco.com
Wed Jul 16 13:09:29 UTC 2008


Quoting Craig:
> I need a way to change (add and delete) milestones via a CLI app.
> (Most likely it will be in Perl, but that isn't definite.)
> 
> I looked at Bugzilla::WebService::Product, but all of the
> routines/methods are marked as not stable.
> 
> What is the "best way" to update milestones for a specific product
> programatically?
> 
> Adding it directly to the DB works just fine for me, but I wanted to
> do it using whatever method is "approved". (Makes upgrades easier. :>
> ) 

cp editmilestones.cgi editmilestones.pl
Then check each reference to $cgi->params() and read an argument or
<STDIN> instead.

(It would be pretty neat to run:
 "echo delete \n myproduct \n mymilestone \n |editmilestones.pl")

sub prompt_for_field {
    my $field = shift;
    my $value;
    while ($value eq "") {
        print "Enter a value for $field: ";
        chomp($value = <>);
    }
    return $value;
}
my $product_name = prompt_for_field("Product");
my $milestone_name = prompt_for_field("Target Milestone");

Editmilestones.cgi is only 360 or so lines and MUCH of it is comments
and whitespace.  Be sure to submit it as a contrib script for the rest
of us to share! ;-)

(using this script to start with is good because it already has the
Bugzilla structure built in with validation and Bugzilla objects and
much of the hard work is done.)



More information about the developers mailing list