[pmg-devel] [PATCH pmg-api 04/11] Backup: push restore options to PMG::Backup
Stoiko Ivanov
s.ivanov at proxmox.com
Wed Oct 28 19:54:22 CET 2020
that way they can be reused for the PBS restore API call
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
src/PMG/API2/Backup.pm | 19 +------------------
src/PMG/Backup.pm | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/src/PMG/API2/Backup.pm b/src/PMG/API2/Backup.pm
index 08c06b5..4ea28d1 100644
--- a/src/PMG/API2/Backup.pm
+++ b/src/PMG/API2/Backup.pm
@@ -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" },
diff --git a/src/PMG/Backup.pm b/src/PMG/Backup.pm
index aec7905..5e11684 100644
--- a/src/PMG/Backup.pm
+++ b/src/PMG/Backup.pm
@@ -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) = @_;
--
2.20.1
More information about the pmg-devel
mailing list