From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 83ECE1FF09B for ; Mon, 12 Oct 2026 16:57:50 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id C12462168B; Mon, 12 Oct 2026 16:57:40 +0200 (CEST) From: Jonas Theisen To: pve-devel@lists.proxmox.com Subject: [PATCH pve-mamager v4 3/3] fix #8031: api: cluster options: update APT proxy config on change Date: Mon, 12 Oct 2026 16:56:49 +0200 Message-ID: <20261012145712.296002-4-j.theisen@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261012145712.296002-1-j.theisen@proxmox.com> References: <20261012145712.296002-1-j.theisen@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1791817051967 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.138 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: LNX7NHWBKZSFV34U2HWQOR3NMNELE7F6 X-Message-ID-Hash: LNX7NHWBKZSFV34U2HWQOR3NMNELE7F6 X-MailFrom: j.theisen@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Changing the http_proxy datacenter option did not update the APT proxy config until the next package database update. Write it right away, so APT on all nodes uses the new proxy immediately. Do so while still holding the datacenter.cfg lock, so concurrent changes cannot write the APT config in a different order than the datacenter config. Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=8031 Signed-off-by: Jonas Theisen --- PVE/API2/Cluster.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm index 4e5efbfd..29820c59 100644 --- a/PVE/API2/Cluster.pm +++ b/PVE/API2/Cluster.pm @@ -23,6 +23,7 @@ use PVE::Tools qw(extract_param); use PVE::API2::ACMEAccount; use PVE::API2::ACMEPlugin; +use PVE::API2::APT; use PVE::API2::Backup; use PVE::API2::Cluster::BackupInfo; use PVE::API2::Cluster::BulkAction; @@ -842,8 +843,17 @@ __PACKAGE__->register_method({ code => sub { my ($param) = @_; + my $http_proxy_change = 0; + my $delete = extract_param($param, 'delete'); + if ( + defined($param->{http_proxy}) + || (defined($delete) && $delete =~ m/\bhttp_proxy\b/) + ) { + $http_proxy_change = 1; + } + cfs_lock_file( 'datacenter.cfg', undef, @@ -855,6 +865,8 @@ __PACKAGE__->register_method({ delete $conf->{$_} for PVE::Tools::split_list($delete); cfs_write_file('datacenter.cfg', $conf); + + PVE::API2::APT::update_apt_proxy_config($conf) if $http_proxy_change; }, ); die $@ if $@; -- 2.47.3