]> git.proxmox.com Git - pmg-api.git/commitdiff
pmgsh: correctly setup RESTEnvironment (set user/role)
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 8 Aug 2017 06:32:31 +0000 (08:32 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 8 Aug 2017 06:32:31 +0000 (08:32 +0200)
bin/pmgsh

index d58479a4f5671ec4c9b0016253769c0d0173e2b7..5447ceae49c50150a77d137910420e71258f08e2 100755 (executable)
--- a/bin/pmgsh
+++ b/bin/pmgsh
@@ -20,12 +20,10 @@ use PMG::API2;
 
 use JSON;
 
-PVE::INotify::inotify_init();
+PMG::RESTEnvironment->setup_default_cli_env();
 
-my $rpcenv = PMG::RESTEnvironment->init('cli');
+my $rpcenv = PMG::RESTEnvironment->get();
 
-$rpcenv->set_language($ENV{LANG});
-$rpcenv->set_user('root@pam');
 my $ticket = PMG::Ticket::assemble_ticket('root@pam');
 
 my $logid = $ENV{PVE_LOG_ID} || 'pmgsh';
@@ -471,6 +469,8 @@ sub pmg_command {
     $rpcenv->init_request();
 
     $rpcenv->set_ticket($ticket);
+    $rpcenv->set_user('root@pam');
+    $rpcenv->set_role('root');
 
     my $cmd = shift @$args;