add setup_environment hooks to CLIHandler classes

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer 2017-01-12 12:33:31 +01:00 committed by Fabian Grünbichler
parent 3656c0b9f3
commit 8a37d2c9c2
4 changed files with 17 additions and 0 deletions

View File

@ -25,6 +25,10 @@ my $upid_exit = sub {
exit($status eq 'OK' ? 0 : -1);
};
sub setup_environment {
PVE::RPCEnvironment->setup_default_cli_env();
}
__PACKAGE__->register_method ({
name => 'update',
path => 'update',

View File

@ -32,6 +32,10 @@ my $upid_exit = sub {
exit($status eq 'OK' ? 0 : -1);
};
sub setup_environment {
PVE::RPCEnvironment->setup_default_cli_env();
}
__PACKAGE__->register_method ({
name => 'purge',
path => 'purge',

View File

@ -14,6 +14,10 @@ use base qw(PVE::CLIHandler);
my $nodename = PVE::INotify::nodename();
sub setup_environment {
PVE::RPCEnvironment->setup_default_cli_env();
}
our $cmddef = {
update => [ 'PVE::API2::Subscription', 'update', undef, { node => $nodename } ],
get => [ 'PVE::API2::Subscription', 'get', undef, { node => $nodename },

View File

@ -3,11 +3,16 @@ package PVE::CLI::vzdump;
use strict;
use warnings;
use PVE::RPCEnvironment;
use PVE::CLIHandler;
use PVE::API2::VZDump;
use base qw(PVE::CLIHandler);
sub setup_environment {
PVE::RPCEnvironment->setup_default_cli_env();
}
# Note: use string 'vmid' as $arg_param option, to allow vmid lists
our $cmddef = [ 'PVE::API2::VZDump', 'vzdump', 'vmid', undef,
sub {