aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2014-11-24 22:03:48 +0000
committerColin Guthrie <colin@mageia.org>2014-11-25 10:31:29 +0000
commitc0627ebbb288b3a448350f7b66f54f85b3e19961 (patch)
treecd0922344814e7d582781cde0a5b96cfbbab7e68
parent926b9c61e34b804ec46b869c218ba828636a9c4e (diff)
downloadmgaadvisories-c0627ebbb288b3a448350f7b66f54f85b3e19961.tar
mgaadvisories-c0627ebbb288b3a448350f7b66f54f85b3e19961.tar.gz
mgaadvisories-c0627ebbb288b3a448350f7b66f54f85b3e19961.tar.bz2
mgaadvisories-c0627ebbb288b3a448350f7b66f54f85b3e19961.tar.xz
mgaadvisories-c0627ebbb288b3a448350f7b66f54f85b3e19961.zip
Add option to post to bugzilla during ID assignment.
Allow the operator to optionally post to Bugzilla (and remove the validated_update keyword) if the id assignment fails during cross checks.
-rw-r--r--NEWS1
-rw-r--r--lib/MGA/Advisories.pm23
2 files changed, 22 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 3bd5e7e..ce6a1a6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,4 @@
+- add support for posting to bugzilla during ID assignment if cross checks fail
- add publishall option to process all pending advisories
- fix bugnum regexp for '12345.mga4' type advisory names
- add check to highlight that the first reference must be the MGA advisory bug
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm
index 0cf72d3..d29d706 100644
--- a/lib/MGA/Advisories.pm
+++ b/lib/MGA/Advisories.pm
@@ -256,8 +256,7 @@ sub assign_id {
$buffer = $msg;
my $found_keyword = 0;
if (scalar($bug->{keywords}) > 0) {
- my $keywords = $bug->{keywords};
- foreach my $keyword (@$keywords) {
+ foreach my $keyword (@{$bug->{keywords}}) {
if ('validated_update' eq $keyword) {
$found_keyword = 1;
last;
@@ -352,6 +351,26 @@ sub assign_id {
if ($failed) {
print STDERR "Error: Cross check failed.\n";
+ if ($found_keyword) {
+ ReadMode 4; # Turn off controls keys
+ print "Post failure message to Bugzilla and reset 'validated_update' keyword (requires login)? [y/N]: ";
+ my $key = 'x';
+ while ( $key ne "\n" && $key ne "y" && $key ne "Y" && $key ne "n" && $key ne "N" ) {
+ $key = ReadKey(0);
+ }
+ ReadMode 0; # Reset tty mode before exiting
+ if ( $key eq "\n" || $key eq "n" || $key eq "N" ) {
+ print " ✘\n";
+ } else {
+ print " ✔\n";
+
+ if (call_bz('Bug.update', { ids => [$bugnum], comment => { body => "Update ID assignment failed\n\n$buffer\n\n'validated_update' keyword reset." }, keywords => { set => grep { $_ ne 'validated_update' } @{$bug->{keywords}} } })) {
+ print "Successfully posted to Bugzilla\n";
+ } else {
+ print "Failed to post to Bugzilla\n";
+ }
+ }
+ }
return;
}
} else {