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