]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
partially revert "api/nodes journal: add and enforce parameter conflicts"
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 15 May 2019 14:02:09 +0000 (16:02 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 15 May 2019 14:05:19 +0000 (16:05 +0200)
This partially reverts commit 51c45d6b4df5eebd831ece8507f6e0d6d132212a
as we had some wrong assumptions about lastentries and the other
params, so just note conflicts in the description but let the tool
itself make the checks

This reverts commit 51c45d6b4df5eebd831ece8507f6e0d6d132212a.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/API2/Nodes.pm

index 1f81d74d55d4d85b2f16ae129d4d0d8b7958db78..ee87ee38fbcd164b94094ea69899679e1ccf0cde 100644 (file)
@@ -725,7 +725,7 @@ __PACKAGE__->register_method({
                optional => 1,
            },
            lastentries => {
-               description => "Limit to the last X lines. Conflicts with any cursor or time range parameters.",
+               description => "Limit to the last X lines. Conflicts with a range.",
                type => 'integer',
                optional => 1,
            },
@@ -754,24 +754,11 @@ __PACKAGE__->register_method({
        my $user = $rpcenv->get_user();
 
        my $cmd = ["/usr/bin/mini-journalreader"];
-
-       my $add_to_cmd = sub {
-           my ($opt, $p, @conflicts) = @_;
-           return if !defined($param->{$p});
-
-           for my $c (@conflicts) {
-               die "parameters '$p' and '$c' conflict with each other!\n"
-                   if defined($param->{$c});
-           }
-
-           push @$cmd, $opt, $param->{$p};
-       };
-
-       $add_to_cmd->('-b', 'since', 'startcursor', 'lastentries');
-       $add_to_cmd->('-e', 'until', 'endcursor', 'lastentries');
-       $add_to_cmd->('-f', 'startcursor', 'lastentries');
-       $add_to_cmd->('-t', 'endcursor', 'lastentries');
-       $add_to_cmd->('-n', 'lastentries');
+       push @$cmd, '-n', $param->{lastentries} if $param->{lastentries};
+       push @$cmd, '-b', $param->{since} if $param->{since};
+       push @$cmd, '-e', $param->{until} if $param->{until};
+       push @$cmd, '-f', $param->{startcursor} if $param->{startcursor};
+       push @$cmd, '-t', $param->{endcursor} if $param->{endcursor};
 
        my $lines = [];
        my $parser = sub { push @$lines, shift };