[pve-devel] [PATCH v2 pve-manager] api, ui: allow to remove subscriptio
Moayad Almalat
m.almalat at proxmox.com
Tue May 26 21:39:45 CEST 2020
Signed-off-by: Moayad Almalat <m.almalat at proxmox.com>
---
PVE/API2/Subscription.pm | 24 ++++++++++++++++++++++++
PVE/CLI/pvesubscription.pm | 1 +
www/manager6/node/Subscription.js | 9 +++++++++
3 files changed, 34 insertions(+)
diff --git a/PVE/API2/Subscription.pm b/PVE/API2/Subscription.pm
index 6657c00d..e1a9c31c 100644
--- a/PVE/API2/Subscription.pm
+++ b/PVE/API2/Subscription.pm
@@ -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;
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..15319429 100644
--- a/www/manager6/node/Subscription.js
+++ b/www/manager6/node/Subscription.js
@@ -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() {
--
2.20.1
More information about the pve-devel
mailing list