]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/CLIHandler.pm
allow fall back to default completion
[pve-common.git] / src / PVE / CLIHandler.pm
index c62837b2d767ec80740c7e04b52f8b0d1140d596..149353797238ef481e135fafb9e65b51259a21bf 100644 (file)
@@ -337,7 +337,7 @@ sub generate_bash_completions {
 # this modifies global var, but I found no better way
 COMP_WORDBREAKS=\${COMP_WORDBREAKS//:}
 
-complete -C '$exename bashcomplete' $exename
+complete -o default -C '$exename bashcomplete' $exename
 __EOD__
 }
 
@@ -482,11 +482,13 @@ sub run_cli_handler {
     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{prepare};
+    my $no_init = $params{no_init};
 
     my $pwcallback = $class->can('read_password');
 
@@ -497,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');
     }