[pve-devel] [PATCH manager] fix #1212: allow options for delete in pvesh

Dominik Csapak d.csapak at proxmox.com
Fri Nov 25 14:30:27 CET 2016


we did not allow to use parameters in the delete handler in pvesh,
but we make use of them (e.g. force on snapshot deleting)

as the get/set and delete handler do the same, refactor the if/else
paths of them

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 bin/pvesh | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/bin/pvesh b/bin/pvesh
index c5debe6..6f7687e 100755
--- a/bin/pvesh
+++ b/bin/pvesh
@@ -515,7 +515,7 @@ sub pve_command {
 
 	list_dir(abs_path($cdir, $path), $args);
 
-    } elsif ($cmd eq 'get') {
+    } elsif ($cmd =~ m/^get|delete|set$/) {
 
 	my $path;
 	if (scalar(@$args) && $args->[0] !~ m/^\-/)  {
@@ -533,23 +533,6 @@ sub pve_command {
 
 	call_method(abs_path($cdir, $path), $cmd, $args, $nooutput);
 
-    } elsif ($cmd eq 'delete') {
-
-	my $path = shift @$args;
-
-	die "usage: delete [path]\n" if scalar(@$args);
-
-	call_method(abs_path($cdir, $path), $cmd, $args);
-
-    } elsif ($cmd eq 'set') {
-
-	my $path;
-	if (scalar(@$args) && $args->[0] !~ m/^\-/)  {
-	    $path = shift @$args;
-	}
-
-	call_method(abs_path($cdir, $path), $cmd, $args);
-
     } else {
 	die "unknown command '$cmd'\n";
     }
-- 
2.1.4





More information about the pve-devel mailing list