[pve-devel] [[PATCH pmg-api] Close #2664 Button Delete Subscription key 1/1] [pmg-api] Close #2664 Delete Subscription key from /etc/pmg/subscription

Moayad Almalat m.almalat at proxmox.com
Mon Apr 20 15:30:17 CEST 2020


Signed-off-by: Moayad Almalat <m.almalat at proxmox.com>
---
 src/PMG/API2/Subscription.pm   | 20 ++++++++++++++++++++
 src/PMG/CLI/pmgsubscription.pm |  1 +
 2 files changed, 21 insertions(+)

diff --git a/src/PMG/API2/Subscription.pm b/src/PMG/API2/Subscription.pm
index d321a9e..d8fe6ac 100644
--- a/src/PMG/API2/Subscription.pm
+++ b/src/PMG/API2/Subscription.pm
@@ -188,4 +188,24 @@ __PACKAGE__->register_method ({
 	return undef;
     }});
 
+__PACKAGE__->register_method ({
+    name => 'delete',
+    path => '',
+    method => 'DELETE',
+    description => "Delete subscription key.",
+    proxyto => 'node',
+    protected => 1,
+    parameters => {
+        additionalProperties => 0,
+        properties => {
+            node => get_standard_option('pve-node'),
+        },
+    },
+    returns => { type => 'null'},
+    code => sub {
+        unlink ("/etc/pmg/subscription");
+        return undef;
+
+}});
+
 1;
diff --git a/src/PMG/CLI/pmgsubscription.pm b/src/PMG/CLI/pmgsubscription.pm
index fdb7afe..a4d5b86 100755
--- a/src/PMG/CLI/pmgsubscription.pm
+++ b/src/PMG/CLI/pmgsubscription.pm
@@ -29,6 +29,7 @@ our $cmddef = {
 		 }
 	     }],
     set => [ 'PMG::API2::Subscription', 'set', ['key'], { node => $nodename } ],
+    delete => [ 'PMG::API2::Subscription', 'delete', undef, { node => $nodename } ],
 };
 
 1;
-- 
2.20.1




More information about the pve-devel mailing list