[pve-devel] r5057 - in pve-manager/pve2: bin lib/PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Thu Aug 26 08:53:58 CEST 2010


Author: dietmar
Date: 2010-08-26 06:53:58 +0000 (Thu, 26 Aug 2010)
New Revision: 5057

Modified:
   pve-manager/pve2/bin/pvesh
   pve-manager/pve2/lib/PVE/REST.pm
Log:
 fix find_handler() calls


Modified: pve-manager/pve2/bin/pvesh
===================================================================
--- pve-manager/pve2/bin/pvesh	2010-08-26 06:52:37 UTC (rev 5056)
+++ pve-manager/pve2/bin/pvesh	2010-08-26 06:53:58 UTC (rev 5057)
@@ -93,9 +93,8 @@
 sub create_entry {
     my ($dir, $args) = @_;
 
-    my $stack = [ split(/\/+/, $dir) ];
     my $uri_param = {};
-    my ($handler, $info) = PVE::API2->find_handler('POST', $stack, $uri_param);
+    my ($handler, $info) = PVE::API2->find_handler('POST', $dir, $uri_param);
     if (!$handler || !$info) {
 	die "no 'create' handler for '$dir'\n";
     }
@@ -110,9 +109,8 @@
 sub get_entry {
     my ($dir, $args) = @_;
 
-    my $stack = [ split(/\/+/, $dir) ];
     my $uri_param = {};
-    my ($handler, $info) = PVE::API2->find_handler('GET', $stack, $uri_param);
+    my ($handler, $info) = PVE::API2->find_handler('GET', $dir, $uri_param);
     if (!$handler || !$info) {
 	die "no 'get' handler for '$dir'\n";
     }
@@ -127,9 +125,8 @@
 sub update_entry {
     my ($dir, $args) = @_;
 
-    my $stack = [ split(/\/+/, $dir) ];
     my $uri_param = {};
-    my ($handler, $info) = PVE::API2->find_handler('PUT', $stack, $uri_param);
+    my ($handler, $info) = PVE::API2->find_handler('PUT', $dir, $uri_param);
     if (!$handler || !$info) {
 	die "no 'update' handler for '$dir'\n";
     }
@@ -144,9 +141,8 @@
 sub delete_entry {
     my ($dir) = @_;
 
-    my $stack = [ split(/\/+/, $dir) ];
     my $uri_param = {};
-    my ($handler, $info) = PVE::API2->find_handler('DELETE', $stack, $uri_param);
+    my ($handler, $info) = PVE::API2->find_handler('DELETE', $dir, $uri_param);
     if (!$handler || !$info) {
 	die "no 'delete' handler for '$dir'\n";
     }
@@ -159,8 +155,7 @@
 sub test_dir {
     my ($dir, $uri_param) = @_;
 
-    my $stack = [ split(/\/+/, $dir) ];
-    my ($handler, $info) = PVE::API2->find_handler('GET', $stack, $uri_param);
+    my ($handler, $info) = PVE::API2->find_handler('GET', $dir, $uri_param);
     return undef if !$handler || !$info;
 
     return wantarray ? ($handler, $info) : 1;

Modified: pve-manager/pve2/lib/PVE/REST.pm
===================================================================
--- pve-manager/pve2/lib/PVE/REST.pm	2010-08-26 06:52:37 UTC (rev 5056)
+++ pve-manager/pve2/lib/PVE/REST.pm	2010-08-26 06:53:58 UTC (rev 5057)
@@ -280,9 +280,8 @@
 
     syslog ('info', "GOT $method $abs_uri VALID TICKET $ticket");
     
-    my $stack = [ grep { length($_) > 0 }  split('\/+' , $rel_uri)] ; # skip empty fragments
     my $uri_param = {};
-    my ($handler, $info) = PVE::API2->find_handler($method, $stack, $uri_param);
+    my ($handler, $info) = PVE::API2->find_handler($method, $rel_uri, $uri_param);
     if (!$handler || !$info) {
 	return {
 	    status => HTTP_NOT_IMPLEMENTED,



More information about the pve-devel mailing list