X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=src%2FPVE%2FCLIHandler.pm;h=f973bdc1ccce6c2425665fa3e5bd2caeb5f82fd5;hb=aeac55e13854fe8d7aeeef545c3f5d65edc34971;hp=c75c8dc9a3cec99e954b0a52a3bc62446ba83b02;hpb=2fff84d9292200eca643555f4494aef21d3a0f63;p=pve-common.git diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm index c75c8dc..f973bdc 100644 --- a/src/PVE/CLIHandler.pm +++ b/src/PVE/CLIHandler.pm @@ -469,7 +469,7 @@ sub run_cli { die "password callback is no longer supported" if $pwcallback; - run_cli_handler($class, podfn => $podfn, preparefunc => $preparefunc); + run_cli_handler($class, podfn => $podfn, prepare => $preparefunc); } sub run_cli_handler { @@ -479,8 +479,16 @@ sub run_cli_handler { $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin'; + foreach my $key (keys %params) { + next if $key eq 'podfn'; + next if $key eq 'prepare'; + next if $key eq 'no_init'; # used by lxc hooks + die "unknown parameter '$key'"; + } + my $podfn = $params{podfn}; - my $preparefunc = $params{preparefunc}; + my $preparefunc = $params{prepare}; + my $no_init = $params{no_init}; my $pwcallback = $class->can('read_password'); @@ -491,10 +499,10 @@ sub run_cli_handler { if ($class !~ m/^PVE::Service::/) { die "please run as root\n" if $> != 0; - PVE::INotify::inotify_init(); + PVE::INotify::inotify_init() if !$no_init; my $rpcenv = PVE::RPCEnvironment->init('cli'); - $rpcenv->init_request(); + $rpcenv->init_request() if !$no_init; $rpcenv->set_language($ENV{LANG}); $rpcenv->set_user('root@pam'); }