]> git.proxmox.com Git - pve-common.git/commitdiff
subscription: use more specific machine repo definition for PVE/PMG
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 27 Nov 2020 14:22:34 +0000 (15:22 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 27 Nov 2020 14:22:38 +0000 (15:22 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Subscription.pm

index 15711524f570bb9bd5643a3de3463b55004d38ad..fe5819b877ffa0230109ccc0ce456ff603733b36 100644 (file)
@@ -188,7 +188,23 @@ sub read_subscription {
 sub update_apt_auth {
     my ($key, $server_id) = @_;
 
-    my $auth = { 'enterprise.proxmox.com' => { login => $key, password => $server_id } };
+    my $repo;
+    if ($key =~ /^pmg/) {
+       $repo = 'pmg';
+    } elsif ($key =~ /^pve/) {
+       $repo = 'pve';
+    } else {
+       warn "unknown key format for '$key', defaulting to pve\n";
+       $repo = 'pve';
+    }
+
+    my $auth = {
+       "enterprise.proxmox.com" => undef, # for dropping the older, to generic match
+       "enterprise.proxmox.com/debian/$repo" => {
+           login => $key,
+           password => $server_id,
+       },
+    };
     PVE::INotify::update_file('apt-auth', $auth);
 }