[pve-devel] [PATCH pve-common 1/3] remove calls to PVE::RPCEnvironment

Dietmar Maurer dietmar at proxmox.com
Thu Jan 12 10:12:14 CET 2017


This introduces a cyclic dependency, so we need to remove this.

PVE::CLI::* classes should instead add ad call to

 PVE::RPCEnvironment->setup_default_cli_env();

Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 src/PVE/CLIHandler.pm | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm
index e2a81a0..199241f 100644
--- a/src/PVE/CLIHandler.pm
+++ b/src/PVE/CLIHandler.pm
@@ -472,14 +472,12 @@ sub run_cli_handler {
 
     foreach my $key (keys %params) {
 	next if $key eq 'prepare';
-	next if $key eq 'no_init'; # used by lxc hooks
-	next if $key eq 'no_rpcenv';
+	next if $key eq 'no_init'; # not used anymore
+	next if $key eq 'no_rpcenv'; # not used anymore
 	die "unknown parameter '$key'";
     }
 
     my $preparefunc = $params{prepare};
-    my $no_init = $params{no_init};
-    my $no_rpcenv = $params{no_rpcenv};
 
     my $pwcallback = $class->can('read_password');
     my $stringfilemap = $class->can('string_param_file_mapping');
@@ -490,15 +488,6 @@ sub run_cli_handler {
 
     if ($class !~ m/^PVE::Service::/) {
 	die "please run as root\n" if $> != 0;
-
-	PVE::INotify::inotify_init() if !$no_init;
-
-	if (!$no_rpcenv) {
-	my $rpcenv = PVE::RPCEnvironment->init('cli');
-	    $rpcenv->init_request() if !$no_init;
-	    $rpcenv->set_language($ENV{LANG});
-	    $rpcenv->set_user('root at pam');
-	}
     }
 
     no strict 'refs';
-- 
2.1.4



More information about the pve-devel mailing list