]> git.proxmox.com Git - pve-manager.git/blame - bin/pvesubscription
add subscription management API
[pve-manager.git] / bin / pvesubscription
CommitLineData
21ace8d3
DM
1#!/usr/bin/perl -w
2
3use strict;
4
5use PVE::Tools;
6use PVE::SafeSyslog;
7use PVE::INotify;
8use PVE::RPCEnvironment;
9use PVE::CLIHandler;
10use PVE::API2::Subscription;
11
12
13use base qw(PVE::CLIHandler);
14
15$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
16
17initlog('pvesubscription');
18
19die "please run as root\n" if $> != 0;
20
21PVE::INotify::inotify_init();
22
23my $rpcenv = PVE::RPCEnvironment->init('cli');
24
25$rpcenv->init_request();
26$rpcenv->set_language($ENV{LANG});
27$rpcenv->set_user('root@pam');
28
29my $nodename = PVE::INotify::nodename();
30
31
32
33my $cmddef = {
34 update => [ 'PVE::API2::Subscription', 'update', undef, { node => $nodename } ],
35 get => [ 'PVE::API2::Subscription', 'get', undef, { node => $nodename },
36 sub {
37 my $info = shift;
38 foreach my $k (sort keys %$info) {
39 print "$k: $info->{$k}\n";
40 }
41 }],
42 set => [ 'PVE::API2::Subscription', 'set', ['key'], { node => $nodename } ],
43};
44
45my $cmd = shift;
46
47PVE::CLIHandler::handle_cmd($cmddef, "pvesubscription", $cmd, \@ARGV, undef, $0);
48
49exit 0;
50
51__END__
52
53=head1 NAME
54
55pvesubscription - Proxmox VE subscription mamager
56
57=head1 SYNOPSIS
58
59=include synopsis
60
61=head1 DESCRIPTION
62
63This tool is used to handle pve subscriptions.
64
65=include pve_copyright