mirror of
https://git.proxmox.com/git/pve-common
synced 2025-07-26 22:31:42 +00:00
run_cli_handler: add no_rpcenv parameter
This can be used if a CLIHandler child class does not needs or wants RPCEnv. E.g. this is the case with pve-cluster, as it's a dependency of the package where RPCEnv resides (access-control), so this can be set to avoid a implicit circular build dependency. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
6e537f49bd
commit
361d54c329
@ -468,11 +468,13 @@ 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';
|
||||
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');
|
||||
@ -486,10 +488,12 @@ sub run_cli_handler {
|
||||
|
||||
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');
|
||||
$rpcenv->init_request() if !$no_init;
|
||||
$rpcenv->set_language($ENV{LANG});
|
||||
$rpcenv->set_user('root@pam');
|
||||
}
|
||||
}
|
||||
|
||||
no strict 'refs';
|
||||
|
Loading…
Reference in New Issue
Block a user