* [pve-devel] [PATCH v2 pve-manager] pvenode task log: don't hardcode 'limit' in CLI
@ 2021-09-01 15:12 Dylan Whyte
0 siblings, 0 replies; only message in thread
From: Dylan Whyte @ 2021-09-01 15:12 UTC (permalink / raw)
To: pve-devel
Removes the hardcoded '--limit' option when setting up the
'pvenode task log' command. This allows a user to control this option
themselves.
Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
---
changes from v1:
* leave the API default in place, and set value based on rpcenv.
* add the option's various defaults (GUI, CLI) to its description.
PVE/API2/Tasks.pm | 4 ++--
PVE/CLI/pvenode.pm | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/PVE/API2/Tasks.pm b/PVE/API2/Tasks.pm
index 9cd1e56b..f19077d0 100644
--- a/PVE/API2/Tasks.pm
+++ b/PVE/API2/Tasks.pm
@@ -349,7 +349,7 @@ __PACKAGE__->register_method({
minimum => 0,
default => 50,
optional => 1,
- description => "The maximum amount of lines that should be printed.",
+ description => "The maximum amount of lines that should be printed. From the GUI, this is set to 500. From the command line, the default is 1000000.",
},
},
},
@@ -379,7 +379,7 @@ __PACKAGE__->register_method({
my $user = $rpcenv->get_user();
my $node = $param->{node};
my $start = $param->{start} // 0;
- my $limit = $param->{limit} // 50;
+ my $limit = $param->{limit} // ($rpcenv->{type} eq 'cli' ? 1000000 : 50);
$convert_token_task->($task);
diff --git a/PVE/CLI/pvenode.pm b/PVE/CLI/pvenode.pm
index acef6c3b..b45735e0 100644
--- a/PVE/CLI/pvenode.pm
+++ b/PVE/CLI/pvenode.pm
@@ -194,8 +194,7 @@ our $cmddef = {
my ($data, $schema, $options) = @_;
PVE::CLIFormatter::print_api_result($data, $schema, undef, $options);
}, $PVE::RESTHandler::standard_output_options],
- # set limit to 1000000, so we see the whole log, not only the first 50 lines by default
- log => [ 'PVE::API2::Tasks', 'read_task_log', [ 'upid' ], { node => $nodename, limit => 1000000 }, sub {
+ log => [ 'PVE::API2::Tasks', 'read_task_log', [ 'upid' ], { node => $nodename }, sub {
my ($data, $resultprops) = @_;
foreach my $line (@$data) {
print $line->{t} . "\n";
--
2.30.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-01 15:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01 15:12 [pve-devel] [PATCH v2 pve-manager] pvenode task log: don't hardcode 'limit' in CLI Dylan Whyte
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.