]> git.proxmox.com Git - pmg-api.git/commitdiff
fix bux #1776: set http_proxy for sa-update
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 3 Sep 2018 10:40:14 +0000 (12:40 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 3 Sep 2018 10:40:14 +0000 (12:40 +0200)
PMG/API2/SpamAssassin.pm
bin/pmg-daily

index 4704077f0cb4879bd5bd594d3d7ec04505aac264..eab02d9707b081402644f532dba691385a24bcca 100644 (file)
@@ -12,6 +12,7 @@ use PMG::RESTEnvironment;
 use PVE::JSONSchema qw(get_standard_option);
 
 use PMG::Utils;
+use PMG::Config;
 
 use Mail::SpamAssassin;
 
@@ -149,6 +150,12 @@ __PACKAGE__->register_method({
        my $realcmd = sub {
            my $upid = shift;
 
+           # setup proxy env (assume sa-update use http)
+           my $pmg_cfg = PMG::Config->new();
+           if (my $http_proxy = $pmg_cfg->get('admin', 'http_proxy')) {
+               $ENV{http_proxy} = $http_proxy;
+           }
+
            my $cmd = "$SAUPDATE -v";
 
            PVE::Tools::run_command($cmd, noerr => 1);
index 7834373b3e0258fc32a2e194fddae025a497554f..32ccb95bc896caddafb276ee36bb19ecf35a0a20 100755 (executable)
@@ -67,6 +67,11 @@ if (my $err = $@) {
 # rotate razor log file
 rename('/root/.razor/razor-agent.log', '/root/.razor/razor-agent.log.0');
 
+# setup proxy env (assume sa-update use http)
+if (my $http_proxy = $cfg->get('admin', 'http_proxy')) {
+    $ENV{http_proxy} = $http_proxy;
+}
+
 # update spamassassin rules
 if (system('sa-update') == 0) {
     # if the exit code is 0, new updates were downloaded