]> git.proxmox.com Git - pve-manager.git/commitdiff
api, ui: allow to remove subscription
authorMoayad Almalat <m.almalat@proxmox.com>
Tue, 26 May 2020 19:39:45 +0000 (21:39 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 27 May 2020 11:28:27 +0000 (13:28 +0200)
Signed-off-by: Moayad Almalat <m.almalat@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/API2/Subscription.pm
PVE/CLI/pvesubscription.pm
www/manager6/node/Subscription.js

index 6657c00d6e5cc2b4bdabbeda8c21cda0f731966d..e1a9c31cbfad3ea9a2702440bb7b96e5cffa5de4 100644 (file)
@@ -245,4 +245,28 @@ __PACKAGE__->register_method ({
        return undef;
     }});
 
+__PACKAGE__->register_method ({
+    name => 'delete',
+    path => '',
+    method => 'DELETE',
+    permissions => {
+       check => ['perm', '/nodes/{node}', [ 'Sys.Modify' ]],
+    },
+    description => "Set subscription key.",
+    proxyto => 'node',
+    protected => 1,
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           node => get_standard_option('pve-node'),
+       },
+    },
+    returns => { type => 'null'},
+    code => sub {
+       my $subscription_file = '/etc/subscription';
+       return if ! -e $subscription_file; 
+       unlink($subscription_file) or die "cannot delete subscription key: $!";
+       return undef;
+    }});
+
 1;
index cd81c41570a656bf537acd334c086b01688d0b4c..751dde5894e39b636eb83723c3c7304d46f79af3 100755 (executable)
@@ -28,6 +28,7 @@ our $cmddef = {
                 }
             }],
     set => [ 'PVE::API2::Subscription', 'set', ['key'], { node => $nodename } ],
+    delete => [ 'PVE::API2::Subscription', 'delete', undef, { node => $nodename } ],
 };
 
 1;
index e4a35874213ed951c42c767d49c5e476ab325ae4..153194291137d3ae0fdd4bbc9ece3feb1126b38f 100644 (file)
@@ -163,6 +163,15 @@ Ext.define('PVE.node.Subscription', {
                        win.on('destroy', reload);
                    }
                },
+               {
+                   text: gettext('Remove Subscription'),
+                   xtype: 'proxmoxStdRemoveButton',
+                   confirmMsg: gettext('Are you sure to remove the subscription key?'),
+                   baseurl: baseurl,
+                   dangerous: true,
+                   selModel: false,
+                   callback: reload,
+               },
                {
                    text: gettext('Check'),
                    handler: function() {