fix #1212: allow options for delete in pvesh

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@proxmox.com>
This commit is contained in:
Dominik Csapak 2016-11-25 14:30:27 +01:00 committed by Dietmar Maurer
parent 087d3bd7fb
commit 35e1fa3fae

View File

@ -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";
}