[pmg-devel] [PATCH pmg-api] pmg-system-report: check for existing sa-awl db
Stoiko Ivanov
s.ivanov at proxmox.com
Tue Feb 26 15:02:30 CET 2019
When run via pmgdaemon the pmg-system-report threw an error, while running
`sa-awl` (it relies on the environment variable HOME being set, for the default
location of the awl database).
This patch checks for the existance of /root/.spamassassin/auto-whitelist and
conditionally runs sa-awl with the file as argument.
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
Thanks to Dominik for catching and analyzing this while writing the GUI for the
System Report.
PMG/Report.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/PMG/Report.pm b/PMG/Report.pm
index aa92366..0472b6a 100644
--- a/PMG/Report.pm
+++ b/PMG/Report.pm
@@ -9,6 +9,8 @@ $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
my $cmd_timeout = 10; # generous timeout
+my $sa_awl_db = '/root/.spamassassin/auto-whitelist';
+
# NOTE: always add new sections to the report_order array!
my $report_def = {
general => {
@@ -44,7 +46,7 @@ my $report_def = {
sub { dir2text('/etc/pmg/','(?:domains|mynetworks|tls_policy|transport)' ) },
sub { dir2text('/etc/pmg/templates/', '[^.].*' ) },
'pmgdb dump',
- 'sa-awl',
+ "[ -f '$sa_awl_db' ] && sa-awl '$sa_awl_db'",
],
};
--
2.11.0
More information about the pmg-devel
mailing list