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

Signed-off-by: Fabian Grünbichler <f.gruenbich...@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to