[pmg-devel] [PATCH pmg-api] use 'dailyreport' config

Dominik Csapak d.csapak at proxmox.com
Thu Sep 6 15:33:12 CEST 2018


the user could enable/disable the dailyreport via the config/webui
but the report did not honor/check this setting

so check it, and do not send a report if this is off

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PMG/CLI/pmgreport.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/PMG/CLI/pmgreport.pm b/PMG/CLI/pmgreport.pm
index ce63aa7..6ae6ca7 100644
--- a/PMG/CLI/pmgreport.pm
+++ b/PMG/CLI/pmgreport.pm
@@ -351,6 +351,13 @@ __PACKAGE__->register_method ({
 	    die "no receiver configured\n";
 	}
 
+	my $enable = $cfg->get('admin', 'dailyreport') // 1;
+
+	if (!$enable) {
+	    # simply do nothing when disabled
+	    return undef;
+	}
+
 	my $mailfrom = "Proxmox Mail Gateway <postmaster>";
 	PMG::Utils::finalize_report($tt, 'pmgreport.tt', $vars, $mailfrom, $email, $param->{debug});
 
-- 
2.11.0




More information about the pmg-devel mailing list