mirror of
https://git.proxmox.com/git/pve-common
synced 2025-07-27 11:44:45 +00:00
remove calls to PVE::RPCEnvironment
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@proxmox.com>
This commit is contained in:
parent
3e3871c3ee
commit
1042b82cc1
@ -472,14 +472,12 @@ sub run_cli_handler {
|
|||||||
|
|
||||||
foreach my $key (keys %params) {
|
foreach my $key (keys %params) {
|
||||||
next if $key eq 'prepare';
|
next if $key eq 'prepare';
|
||||||
next if $key eq 'no_init'; # used by lxc hooks
|
next if $key eq 'no_init'; # not used anymore
|
||||||
next if $key eq 'no_rpcenv';
|
next if $key eq 'no_rpcenv'; # not used anymore
|
||||||
die "unknown parameter '$key'";
|
die "unknown parameter '$key'";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $preparefunc = $params{prepare};
|
my $preparefunc = $params{prepare};
|
||||||
my $no_init = $params{no_init};
|
|
||||||
my $no_rpcenv = $params{no_rpcenv};
|
|
||||||
|
|
||||||
my $pwcallback = $class->can('read_password');
|
my $pwcallback = $class->can('read_password');
|
||||||
my $stringfilemap = $class->can('string_param_file_mapping');
|
my $stringfilemap = $class->can('string_param_file_mapping');
|
||||||
@ -490,15 +488,6 @@ sub run_cli_handler {
|
|||||||
|
|
||||||
if ($class !~ m/^PVE::Service::/) {
|
if ($class !~ m/^PVE::Service::/) {
|
||||||
die "please run as root\n" if $> != 0;
|
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@pam');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
no strict 'refs';
|
no strict 'refs';
|
||||||
|
Loading…
Reference in New Issue
Block a user