summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Derumier <aderumier@odiso.com>2024-01-04 17:11:35 +0100
committerThomas Lamprecht <t.lamprecht@proxmox.com>2024-01-22 12:05:40 +0100
commit6e96fd3314b6d355b6f9df4712b721e08b0ccd11 (patch)
tree4f44d5a74ba6dd7ba1eb6d269b4bc4a522763e94
parent9f4525c350fffc559b71d75b52765638822b8e2f (diff)
sdn: prefer proxy from datacenter.cfg for api calls
We only setup proxies from the environment previously, but also check the one configured in the cluster-wide datacenter.cfg and prefer that over anything else. Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
-rw-r--r--src/PVE/Network/SDN.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
index 29213c6..c7dccfa 100644
--- a/src/PVE/Network/SDN.pm
+++ b/src/PVE/Network/SDN.pm
@@ -264,10 +264,9 @@ sub api_request {
my $req = HTTP::Request->new($method,$url, $headers, $encoded_data);
my $ua = LWP::UserAgent->new(protocols_allowed => ['http', 'https'], timeout => 30);
- my $proxy = undef;
-
- if ($proxy) {
- $ua->proxy(['http', 'https'], $proxy);
+ my $datacenter_cfg = PVE::Cluster::cfs_read_file('datacenter.cfg');
+ if (my $proxy = $datacenter_cfg->{http_proxy}) {
+ $ua->proxy(['http', 'https'], $proxy);
} else {
$ua->env_proxy;
}