]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/CLIHandler.pm
Fix #132: hold a lock while setting up vlan bridges
[pve-common.git] / src / PVE / CLIHandler.pm
index 0e7f20250639850af968cc50efa990ea4188a350..2a9a6c9e8e0d9bba534e164d1bf13de178f54487 100644 (file)
@@ -450,7 +450,12 @@ my $handle_simple_cmd = sub {
 sub run_cli {
     my ($class, $pwcallback, $podfn, $preparefunc) = @_;
 
-    die "depreciated function run_cli - use run_cli_handler instead";
+    # Note: "depreciated function run_cli - use run_cli_handler instead";
+    # silently ignore $podfn , which is no longer supported.
+
+    die "password callback is no longer supported" if $pwcallback;
+
+    run_cli_handler($class, prepare => $preparefunc);
 }
 
 sub run_cli_handler {
@@ -463,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');
@@ -481,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';