[pve-devel] [PATCH manager] subscription: remove ceph APT auth if invalid

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Oct 25 15:34:35 CEST 2023


like we do for the main APT auth file(s) in proxmox-subscription.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 PVE/API2/Subscription.pm | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/PVE/API2/Subscription.pm b/PVE/API2/Subscription.pm
index 7c1e300ba..836e7a86f 100644
--- a/PVE/API2/Subscription.pm
+++ b/PVE/API2/Subscription.pm
@@ -94,14 +94,18 @@ sub write_etc_subscription {
     Proxmox::RS::Subscription::write_subscription(
         $filename, "/etc/apt/auth.conf.d/pve.conf", "enterprise.proxmox.com/debian/pve", $info);
 
-    # FIXME: improve this, especially the selection of valid ceph-releases
-    # NOTE: currently we should add future ceph releases as early as possible, to ensure that
-    my $ceph_auth = '';
-    for my $ceph_release ('quincy', 'reef') {
-	$ceph_auth .= "machine enterprise.proxmox.com/debian/ceph-${ceph_release}"
+    if (!(defined($info->{key}) && defined($info->{serverid}))) {
+	unlink "/etc/apt/auth.conf.d/ceph.conf";
+    } else {
+	# FIXME: improve this, especially the selection of valid ceph-releases
+	# NOTE: currently we should add future ceph releases as early as possible, to ensure that
+	my $ceph_auth = '';
+	for my $ceph_release ('quincy', 'reef') {
+	    $ceph_auth .= "machine enterprise.proxmox.com/debian/ceph-${ceph_release}"
 	    ." login $info->{key} password $info->{serverid}\n"
+	}
+	PVE::Tools::file_set_contents("/etc/apt/auth.conf.d/ceph.conf", $ceph_auth);
     }
-    PVE::Tools::file_set_contents("/etc/apt/auth.conf.d/ceph.conf", $ceph_auth);
 }
 
 __PACKAGE__->register_method ({
-- 
2.39.2






More information about the pve-devel mailing list