* [pmg-devel] [PATCH pmg-api] backup: add SA custom score file to backup
@ 2020-11-10 17:56 Stoiko Ivanov
2020-11-18 7:12 ` [pmg-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2020-11-10 17:56 UTC (permalink / raw)
To: pmg-devel
/etc/mail/spamassassin/pmg-scores.cf contains the custom scores users can
set via GUI. It should be included in the backup (and restored if present).
Reported via our community forum:
https://forum.proxmox.com/threads/backup-restore-bug.78605/
Tested on my local setup by creating a bogus score, creating a backup,
removing the pmg-scores file and restoring the backup.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
src/PMG/Backup.pm | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/PMG/Backup.pm b/src/PMG/Backup.pm
index e77f67c..275fa12 100644
--- a/src/PMG/Backup.pm
+++ b/src/PMG/Backup.pm
@@ -13,7 +13,10 @@ use PMG::pmgcfg;
use PMG::AtomicFile;
use PMG::Utils qw(postgres_admin_cmd);
-my $sa_custom_config_fn = "/etc/mail/spamassassin/custom.cf";
+my $sa_configs = [
+ "/etc/mail/spamassassin/custom.cf",
+ "/etc/mail/spamassassin/pmg-scores.cf",
+];
sub get_restore_options {
return (
@@ -202,7 +205,7 @@ sub pmg_backup {
my $extra_cfgs = [];
- push @$extra_cfgs, $sa_custom_config_fn;
+ push @$extra_cfgs, @{$sa_configs};
my $extradb = $include_statistics ? $statfn : '';
@@ -308,10 +311,12 @@ sub pmg_restore {
system("cp -a $dirname/config/etc/pmg/* /etc/pmg/") == 0 ||
die "unable to restore system configuration: ERROR";
- if (-f "$dirname/config/${sa_custom_config_fn}") {
- my $data = PVE::Tools::file_get_contents(
- "$dirname/config/${sa_custom_config_fn}", 1024*1024);
- PVE::Tools::file_set_contents($sa_custom_config_fn, $data);
+ for my $sa_cfg (@{$sa_configs}) {
+ if (-f "$dirname/config/${sa_cfg}") {
+ my $data = PVE::Tools::file_get_contents(
+ "$dirname/config/${sa_cfg}", 1024*1024);
+ PVE::Tools::file_set_contents($sa_cfg, $data);
+ }
}
my $cfg = PMG::Config->new();
--
2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pmg-devel] applied: [PATCH pmg-api] backup: add SA custom score file to backup
2020-11-10 17:56 [pmg-devel] [PATCH pmg-api] backup: add SA custom score file to backup Stoiko Ivanov
@ 2020-11-18 7:12 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2020-11-18 7:12 UTC (permalink / raw)
To: Stoiko Ivanov, pmg-devel
On 10.11.20 18:56, Stoiko Ivanov wrote:
> /etc/mail/spamassassin/pmg-scores.cf contains the custom scores users can
> set via GUI. It should be included in the backup (and restored if present).
>
> Reported via our community forum:
> https://forum.proxmox.com/threads/backup-restore-bug.78605/
>
> Tested on my local setup by creating a bogus score, creating a backup,
> removing the pmg-scores file and restoring the backup.
>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> src/PMG/Backup.pm | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-18 7:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 17:56 [pmg-devel] [PATCH pmg-api] backup: add SA custom score file to backup Stoiko Ivanov
2020-11-18 7:12 ` [pmg-devel] applied: " Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal