aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MGA/Advisories.pm
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 /lib/MGA/Advisories.pm
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.
Diffstat (limited to 'lib/MGA/Advisories.pm')
-rw-r--r--lib/MGA/Advisories.pm23
1 files changed, 21 insertions, 2 deletions
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 {