]>
Commit | Line | Data |
---|---|---|
21ace8d3 DM |
1 | #!/usr/bin/perl -w |
2 | ||
3 | use strict; | |
4 | ||
5 | use PVE::Tools; | |
6 | use PVE::SafeSyslog; | |
7 | use PVE::INotify; | |
8 | use PVE::RPCEnvironment; | |
9 | use PVE::CLIHandler; | |
10 | use PVE::API2::Subscription; | |
11 | ||
12 | ||
13 | use base qw(PVE::CLIHandler); | |
14 | ||
15 | $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin'; | |
16 | ||
17 | initlog('pvesubscription'); | |
18 | ||
19 | die "please run as root\n" if $> != 0; | |
20 | ||
21 | PVE::INotify::inotify_init(); | |
22 | ||
23 | my $rpcenv = PVE::RPCEnvironment->init('cli'); | |
24 | ||
25 | $rpcenv->init_request(); | |
26 | $rpcenv->set_language($ENV{LANG}); | |
27 | $rpcenv->set_user('root@pam'); | |
28 | ||
29 | my $nodename = PVE::INotify::nodename(); | |
30 | ||
31 | ||
32 | ||
33 | my $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 | ||
45 | my $cmd = shift; | |
46 | ||
47 | PVE::CLIHandler::handle_cmd($cmddef, "pvesubscription", $cmd, \@ARGV, undef, $0); | |
48 | ||
49 | exit 0; | |
50 | ||
51 | __END__ | |
52 | ||
53 | =head1 NAME | |
54 | ||
55 | pvesubscription - Proxmox VE subscription mamager | |
56 | ||
57 | =head1 SYNOPSIS | |
58 | ||
59 | =include synopsis | |
60 | ||
61 | =head1 DESCRIPTION | |
62 | ||
63 | This tool is used to handle pve subscriptions. | |
64 | ||
65 | =include pve_copyright |