From d0610a6b4f36c9a648e5d661b6fc4ea12cef1793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominic=20J=C3=A4ger?= Date: Mon, 16 Nov 2020 10:44:11 +0100 Subject: [PATCH] vzdump mail: fix #3136: Add name to plain/text part MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The html/text part already has VMID NAME STATUS TIME..., but the text part only had VMID STATUS TIME... so far. Therefore, add the missing "name" column. Limit the length of names so that the content of the following columns remains aligned to the headings. Note that (like before, too) this only works with monospaced fonts. Signed-off-by: Dominic Jäger --- PVE/VZDump.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm index 517becb1..1096d594 100644 --- a/PVE/VZDump.pm +++ b/PVE/VZDump.pm @@ -258,18 +258,20 @@ sub sendmail { # text part my $text = $err ? "$err\n\n" : ''; - $text .= sprintf ("%-10s %-6s %10s %10s %s\n", qw(VMID STATUS TIME SIZE FILENAME)); + $text .= sprintf ("%-10s %-20s %-6s %10s %10s %s\n", qw(VMID NAME STATUS TIME SIZE FILENAME)); foreach my $task (@$tasklist) { my $vmid = $task->{vmid}; if ($task->{state} eq 'ok') { - $text .= sprintf ("%-10s %-6s %10s %10s %s\n", $vmid, + $text .= sprintf ("%-10s %-20s %-6s %10s %10s %s\n", $vmid, + substr($task->{hostname}, 0, 20), $task->{state}, format_time($task->{backuptime}), format_size ($task->{size}), $task->{target}); } else { - $text .= sprintf ("%-10s %-6s %10s %8.2fMB %s\n", $vmid, + $text .= sprintf ("%-10s %-20s %-6s %10s %8.2fMB %s\n", $vmid, + substr($task->{hostname}, 0, 20), $task->{state}, format_time($task->{backuptime}), 0, '-');