my $secret_dir = '/etc/pmg/pbs';
my $config_filename = "${secret_dir}/pbs.conf";
-
my %prune_option = (
optional => 1,
type => 'integer', minimum => '0',
},
'keep-hourly' => {
%prune_option,
- description => 'Keep backups for the last <N> different hours. If there is more' .
- 'than one backup for a single hour, only the latest one is kept.'
+ description => 'Keep backups for the last <N> different hours. If there is'
+ .' more than one backup for a single hour, only the latest one is kept.'
},
'keep-daily' => {
%prune_option,
- description => 'Keep backups for the last <N> different days. If there is more' .
- 'than one backup for a single day, only the latest one is kept.'
+ description => 'Keep backups for the last <N> different days. If there is'
+ .' more than one backup for a single day, only the latest one is kept.'
},
'keep-weekly' => {
%prune_option,
- description => 'Keep backups for the last <N> different weeks. If there is more' .
- 'than one backup for a single week, only the latest one is kept.'
+ description => 'Keep backups for the last <N> different weeks. If there is'
+ .'more than one backup for a single week, only the latest one is kept.'
},
'keep-monthly' => {
%prune_option,
- description => 'Keep backups for the last <N> different months. If there is more' .
- 'than one backup for a single month, only the latest one is kept.'
+ description => 'Keep backups for the last <N> different months. If there is'
+ .' more than one backup for a single month, only the latest one is kept.'
},
'keep-yearly' => {
%prune_option,
- description => 'Keep backups for the last <N> different years. If there is more' .
- 'than one backup for a single year, only the latest one is kept.'
+ description => 'Keep backups for the last <N> different years. If there is'
+ .' more than one backup for a single year, only the latest one is kept.'
},
);
sub properties {
return {
datastore => {
- description => "Proxmox backup server datastore name.",
+ description => "Proxmox Backup Server datastore name.",
type => 'string',
},
server => {
- description => "Proxmox backup server address.",
+ description => "Proxmox Backup Server address.",
type => 'string', format => 'address',
maxLength => 256,
},
disable => {
- description => "Flag to disable/deactivate the entry.",
+ description => "Flag to disable (deactivate) the entry.",
type => 'boolean',
optional => 1,
},
password => {
- description => "Password for the user on the Proxmox backup server.",
+ description => "Password or API token secret for the user on the"
+ ." Proxmox Backup Server.",
type => 'string',
optional => 1,
},
username => get_standard_option('pmg-email-address', {
- description => "Username on the Proxmox backup server"
+ description => "Username or API token ID on the Proxmox Backup Server"
}),
fingerprint => get_standard_option('fingerprint-sha256'),
%prune_properties,
my $remote_cfg = $self->{ids}->{$remote};
my $res = {};
-
foreach my $keep_opt (keys %prune_properties) {
-
if (defined($remote_cfg->{$keep_opt})) {
$res->{$keep_opt} = $remote_cfg->{$keep_opt};
}
PVE::INotify::write_file($inotify_file_id, $self);
}
-my $lockfile = "/var/lock/pmgpbsconfig.lck";
-
sub lock_config {
my ($code, $errmsg) = @_;
+ my $lockfile = "/var/lock/pmgpbsconfig.lck";
+
my $p = PVE::Tools::lock_file($lockfile, undef, $code);
if (my $err = $@) {
$errmsg ? die "$errmsg: $err" : die $err;
}
}
-
__PACKAGE__->register();
__PACKAGE__->init();
PVE::Tools::safe_print($filename, $fh, $raw);
}
-PVE::INotify::register_file($inotify_file_id, $config_filename,
- \&read_pmg_pbs_conf,
- \&write_pmg_pbs_conf,
- undef,
- always_call_parser => 1);
+PVE::INotify::register_file(
+ $inotify_file_id,
+ $config_filename,
+ \&read_pmg_pbs_conf,
+ \&write_pmg_pbs_conf,
+ undef,
+ always_call_parser => 1
+);
1;