aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-06-13 12:44:43 +0000
committerNicolas Vigier <boklm@mageia.org>2013-06-13 12:44:43 +0000
commit0be9f48b2fd34fec24c64719ac991d9e7742e515 (patch)
tree865f8a9a75e79f5709dcd8ecfa290cbe6a8db271 /lib
parent434f175a6afea9241473bbee01a84d990fab5ab8 (diff)
downloadmgaadvisories-0be9f48b2fd34fec24c64719ac991d9e7742e515.tar
mgaadvisories-0be9f48b2fd34fec24c64719ac991d9e7742e515.tar.gz
mgaadvisories-0be9f48b2fd34fec24c64719ac991d9e7742e515.tar.bz2
mgaadvisories-0be9f48b2fd34fec24c64719ac991d9e7742e515.tar.xz
mgaadvisories-0be9f48b2fd34fec24c64719ac991d9e7742e515.zip
Add command to add a new advisory
Diffstat (limited to 'lib')
-rw-r--r--lib/MGA/Advisories.pm19
1 files changed, 19 insertions, 0 deletions
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;