]> git.proxmox.com Git - pve-manager.git/commitdiff
subscription: remove ceph APT auth if invalid
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 25 Oct 2023 13:34:35 +0000 (15:34 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 25 Oct 2023 16:45:48 +0000 (18:45 +0200)
like we do for the main APT auth file(s) in proxmox-subscription.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/API2/Subscription.pm

index 7c1e300baea6bf6cd666d803515321b249017806..836e7a86f61f513e263ef5814d716a0df54af82c 100644 (file)
@@ -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 ({