aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 {