[pve-devel] [PATCH pve-manager] add setup_environment hooks to CLIHandler classes

Dietmar Maurer dietmar at proxmox.com
Thu Jan 12 12:33:31 CET 2017


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 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 f089447..ef03d25 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 0a5ae21..4bec989 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 f847922..cd81c41 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 90ab496..fe5fd04 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 {
-- 
2.1.4



More information about the pve-devel mailing list