[pve-devel] [[PATCH pve-manager] Button Delete Subscription key 1/1] [pve-manager] Add button to delete Subscription key. Delete Subcription key from "/etc/subscription"

Moayad Almalat m.almalat at proxmox.com
Mon Apr 20 14:00:57 CEST 2020


Signed-off-by: Moayad Almalat <m.almalat at proxmox.com>
---
 PVE/API2/Subscription.pm          | 22 ++++++++++++++++++++++
 PVE/CLI/pvesubscription.pm        |  1 +
 www/manager6/node/Subscription.js |  8 ++++++++
 3 files changed, 31 insertions(+)

diff --git a/PVE/API2/Subscription.pm b/PVE/API2/Subscription.pm
index 6657c00d..46895997 100644
--- a/PVE/API2/Subscription.pm
+++ b/PVE/API2/Subscription.pm
@@ -245,4 +245,26 @@ __PACKAGE__->register_method ({
 	return undef;
     }});
 
+__PACKAGE__->register_method ({
+    name => 'delete',
+    path => '',
+    method => 'DELETE',
+    permissions => {
+        check => ['perm', '/nodes/{node}', [ 'Sys.Modify' ]],
+    },
+    description => "Delete subscription key.",
+    proxyto => 'node',
+    protected => 1,
+    parameters => {
+        additionalProperties => 0,
+        properties => {
+            node => get_standard_option('pve-node'),
+
+        },
+    },
+    code => sub {
+        unlink ("/etc/subscription");
+        return undef;
+    }});
+
 1;
diff --git a/PVE/CLI/pvesubscription.pm b/PVE/CLI/pvesubscription.pm
index cd81c415..751dde58 100755
--- a/PVE/CLI/pvesubscription.pm
+++ b/PVE/CLI/pvesubscription.pm
@@ -28,6 +28,7 @@ our $cmddef = {
 		 }
 	     }],
     set => [ 'PVE::API2::Subscription', 'set', ['key'], { node => $nodename } ],
+    delete => [ 'PVE::API2::Subscription', 'delete', undef, { node => $nodename } ],
 };
 
 1;
diff --git a/www/manager6/node/Subscription.js b/www/manager6/node/Subscription.js
index e4a35874..7f93cd80 100644
--- a/www/manager6/node/Subscription.js
+++ b/www/manager6/node/Subscription.js
@@ -163,6 +163,14 @@ Ext.define('PVE.node.Subscription', {
 			win.on('destroy', reload);
 		    }
 		},
+                {
+                    text: gettext('Delete Subscription Key'),
+                    xtype: 'proxmoxStdRemoveButton',
+                    confirmMsg: 'Are you sure to delete Subscription Key?',
+                    getUrl: () => '/api2/extjs' + baseurl,
+                    dangerous: true,
+                    callback: reload,
+                },
 		{
 		    text: gettext('Check'),
 		    handler: function() {
-- 
2.20.1




More information about the pve-devel mailing list