]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/CLIHandler.pm
bump version to 4.0-28
[pve-common.git] / src / PVE / CLIHandler.pm
index c75c8dc9a3cec99e954b0a52a3bc62446ba83b02..f973bdc1ccce6c2425665fa3e5bd2caeb5f82fd5 100644 (file)
@@ -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');
     }