From 0be9f48b2fd34fec24c64719ac991d9e7742e515 Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Thu, 13 Jun 2013 12:44:43 +0000 Subject: Add command to add a new advisory --- lib/MGA/Advisories.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib/MGA') diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm index b82f181..c5a31e1 100644 --- a/lib/MGA/Advisories.pm +++ b/lib/MGA/Advisories.pm @@ -208,4 +208,23 @@ sub dumpdb { DumpFile($config->{out_dir} . '/advisories.yaml', $advdb->{advisories}); } +sub newadv { + my ($type, $bugnum) = @_; + my $file = $config->{advisories_dir} . '/' . $bugnum . '.adv'; + if (-f $file) { + print STDERR "File $file already exists\n"; + return undef; + } + my $template = Template->new( + INCLUDE_PATH => $config->{tmpl_dir}, + OUTPUT_PATH => $config->{advisories_dir}, + ); + my $vars = { + type => $type, + bugnum => $bugnum, + }; + process_template($template, 'newadvisory', $vars, $bugnum, 'adv'); + return $file; +} + 1; -- cgit v1.2.1