[Fedora-security-commits] fedora-security/tools/lib/Libexig Bugzilla.pm, 1.1.2.2, 1.1.2.3

fedora-security-commits at redhat.com fedora-security-commits at redhat.com
Wed Jan 9 14:37:45 UTC 2008


Author: thoger

Update of /cvs/fedora/fedora-security/tools/lib/Libexig
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv27408/tools/lib/Libexig

Modified Files:
      Tag: lkundrak-tools-ng
	Bugzilla.pm 
Log Message:
make add_comment more generic wrapper for addComment
add close_bug*



Index: Bugzilla.pm
===================================================================
RCS file: /cvs/fedora/fedora-security/tools/lib/Libexig/Attic/Bugzilla.pm,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- Bugzilla.pm	8 Jan 2008 16:15:51 -0000	1.1.2.2
+++ Bugzilla.pm	9 Jan 2008 14:37:43 -0000	1.1.2.3
@@ -147,15 +147,18 @@
 	return undef;
 }
 
-# Add comment to a bug (unless in dryrun mode)
-# Arguments: bug id, comment, make comment private (0/1)
+# Add comment - wrapper around bugzilla addComment XMLRPC method
+#
+# Mandatory arguments:
+#   bugid, comment
+# Optional arguments:
+#   isprivate, timestamp, worktime, bz_gid, private_in_it, nomail
 sub add_comment
 {
 	my $self = shift;
 
 	my $bug = shift or die 'No bug!';
 	my $comment = shift or die 'No comment!';
-	my $private;  $private = shift or $private= 0;
 
 	if ($self->{dryrun}) {
 		print STDERR 'Would add following comment to bug: #'.$bug."\n";
@@ -164,7 +167,7 @@
 	}
 
 	my $call = $self->{rpc}->call('bugzilla.addComment', $bug, $comment,
-		@{$self->{creds}}, $private);
+		@{$self->{creds}}, @_);
 
 	my $result = $call->result
 		or die $call->faultstring;
@@ -175,13 +178,66 @@
 }
 
 # Add private comment to a bug
+#
+# Arguments:
+#   bugid, comment
 sub add_private_comment
 {
 	my $self = shift;
+
 	my $bug = shift;
 	my $comment = shift;
 
 	$self->add_comment($bug, $comment, 1);
 }
 
+# Close bug - wrapper around bugzilla closeBug XMLRPC method
+#
+# Mandatory arguments:
+#   bugid, resolution
+# Optional arguments:
+#   dupeid, fixedin, comment, isprivate, private_in_it, nomail
+sub close_bug
+{
+	my $self = shift;
+
+	my $bug = shift or die 'No bug!';
+	my $resolution = shift or die 'No resolution!';
+
+	if ($self->{dryrun}) {
+		print STDERR 'Would close bug #'.$bug.' as: '.$resolution."\n";
+		return 0;
+	}
+
+	my $call = $self->{rpc}->call('bugzilla.closeBug', $bug, $resolution,
+		@{$self->{creds}}, @_);
+
+	my $result = $call->result
+		or die $call->faultstring;
+
+	print STDERR 'Bugzilla answered to closeBug: '.Dumper($result)
+		if $self->{debug}; 
+	return undef;
+}
+
+# Close bug with comment
+#
+# Mandatory arguments:
+#   bugid, resulution, comment
+# Optional arguments:
+#   newfixedin, dupeid
+sub close_bug_with_comment
+{
+	my $self = shift;
+
+	my $bug = shift;
+	my $resolution = shift;
+	my $comment = shift or die 'No comment!';
+
+	my $fixedin = shift;
+	my $dupeid = shift;
+
+	$self->close_bug($bug, $resolution, $dupeid, $fixedin, $comment);
+}
+
 1;




More information about the Fedora-security-commits mailing list