From 8a37d2c9c2d6f25b9ad5daa880545abadc80df72 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 12 Jan 2017 12:33:31 +0100 Subject: [PATCH] add setup_environment hooks to CLIHandler classes Signed-off-by: Dietmar Maurer --- PVE/CLI/pveam.pm | 4 ++++ PVE/CLI/pveceph.pm | 4 ++++ PVE/CLI/pvesubscription.pm | 4 ++++ PVE/CLI/vzdump.pm | 5 +++++ 4 files changed, 17 insertions(+) diff --git a/PVE/CLI/pveam.pm b/PVE/CLI/pveam.pm index f089447e7..ef03d2587 100644 --- a/PVE/CLI/pveam.pm +++ b/PVE/CLI/pveam.pm @@ -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', diff --git a/PVE/CLI/pveceph.pm b/PVE/CLI/pveceph.pm index 0a5ae2148..4bec98992 100755 --- a/PVE/CLI/pveceph.pm +++ b/PVE/CLI/pveceph.pm @@ -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', diff --git a/PVE/CLI/pvesubscription.pm b/PVE/CLI/pvesubscription.pm index f84792255..cd81c4157 100755 --- a/PVE/CLI/pvesubscription.pm +++ b/PVE/CLI/pvesubscription.pm @@ -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 }, diff --git a/PVE/CLI/vzdump.pm b/PVE/CLI/vzdump.pm index 90ab496eb..fe5fd0498 100755 --- a/PVE/CLI/vzdump.pm +++ b/PVE/CLI/vzdump.pm @@ -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 {