aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MGA
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MGA')
-rw-r--r--lib/MGA/Advisories.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm
index cbabd68..c8514fa 100644
--- a/lib/MGA/Advisories.pm
+++ b/lib/MGA/Advisories.pm
@@ -821,4 +821,27 @@ sub showadv {
print $advtxt;
}
+sub showadvjson {
+ my ($advdb, $adv) = @_;
+ if (!$advdb->{advisories}{$adv}) {
+ print STDERR "Cannot find advisory $adv\n";
+ return undef;
+ }
+ my $template = Template->new(
+ ENCODING => 'utf8',
+ INCLUDE_PATH => $config->{tmpl_dir},
+ EVAL_PERL => 1,
+ );
+ my $vars = {
+ config => $config,
+ advisory => $adv,
+ advdb => $advdb,
+ basename => \%basename,
+ tools => \%tools,
+ };
+ my $advtxt;
+ process_template($template, 'advisory', $vars, \$advtxt, 'json');
+ print $advtxt;
+}
+
1;