aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2020-11-08 13:36:05 +0000
committerPascal Terjan <pterjan@mageia.org>2020-11-08 13:36:05 +0000
commitb667bc060067d784cb0236b7c03644738026687e (patch)
treef6a81882d074f572b44206d1848e1ef982163ce5
parent9124b470e75340b707025a8c0b60c408f0e48be1 (diff)
downloadmgaadvisories-b667bc060067d784cb0236b7c03644738026687e.tar
mgaadvisories-b667bc060067d784cb0236b7c03644738026687e.tar.gz
mgaadvisories-b667bc060067d784cb0236b7c03644738026687e.tar.bz2
mgaadvisories-b667bc060067d784cb0236b7c03644738026687e.tar.xz
mgaadvisories-b667bc060067d784cb0236b7c03644738026687e.zip
Report the broken file rather than exploding when an advisory is invalid
-rw-r--r--lib/MGA/Advisories.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm
index 9b29342..cbabd68 100644
--- a/lib/MGA/Advisories.pm
+++ b/lib/MGA/Advisories.pm
@@ -170,7 +170,15 @@ sub login_bz {
sub get_advisories_from_dir {
my %advisories;
foreach my $advfile (glob "$config->{advisories_dir}/*.adv") {
- my $adv = LoadFile($advfile);
+ my $adv;
+ eval {
+ $adv = LoadFile($advfile);
+ };
+ if ($@) {
+ print "Failed to load $advfile\n";
+ print $@;
+ next;
+ }
if (!$adv->{ID}) {
next unless $config->{mode} eq 'qa';
$adv->{ref} = basename($advfile, ".adv");