]> git.proxmox.com Git - pmg-api.git/commitdiff
Backup: push restore options to PMG::Backup
authorStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 28 Oct 2020 18:54:22 +0000 (19:54 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 30 Oct 2020 06:33:05 +0000 (07:33 +0100)
that way they can be reused for the PBS restore API call

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PMG/API2/Backup.pm
src/PMG/Backup.pm

index 08c06b5a9de36f6c6f1322281afa4dcacc9f8fa9..4ea28d13e28f23956ec7e0ff64e77ea04a333a53 100644 (file)
@@ -202,26 +202,9 @@ __PACKAGE__->register_method ({
     parameters => {
        additionalProperties => 0,
        properties => {
+           PMG::Backup::get_restore_options(),
            node => get_standard_option('pve-node'),
            filename => $backup_filename_property,
-           config => {
-               description => "Restore system configuration.",
-               type => 'boolean',
-               optional => 1,
-               default => 0,
-           },
-           database => {
-               description => "Restore the rule database. This is the default.",
-               type => 'boolean',
-               optional => 1,
-               default => 1,
-           },
-           statistic => {
-               description => "Restore statistic databases. Only considered when you restore the 'database'.",
-               type => 'boolean',
-               optional => 1,
-               default => 0,
-           },
        },
     },
     returns => { type => "string" },
index aff8814a52cc1bab01eb4ea840cb79fb40267535..e77f67cdb6b4f6f2e0989b0812ae8e0ad3deb73f 100644 (file)
@@ -6,6 +6,7 @@ use Data::Dumper;
 use File::Basename;
 use File::Path;
 
+use PVE::JSONSchema qw(get_standard_option);
 use PVE::Tools;
 
 use PMG::pmgcfg;
@@ -14,6 +15,29 @@ use PMG::Utils qw(postgres_admin_cmd);
 
 my $sa_custom_config_fn = "/etc/mail/spamassassin/custom.cf";
 
+sub get_restore_options {
+    return (
+       node => get_standard_option('pve-node'),
+       config => {
+           description => "Restore system configuration.",
+           type => 'boolean',
+           optional => 1,
+           default => 0,
+       },
+       database => {
+           description => "Restore the rule database. This is the default.",
+           type => 'boolean',
+           optional => 1,
+           default => 1,
+       },
+       statistic => {
+           description => "Restore statistic databases. Only considered when you restore the 'database'.",
+           type => 'boolean',
+           optional => 1,
+           default => 0,
+       });
+}
+
 sub dump_table {
     my ($dbh, $table, $ofh, $seq, $seqcol) = @_;