[pve-devel] [PATCH v9 common 1/2] tools: download_file_from_url: adapt error messages to start at new line

Lorenz Stechauner l.stechauner at proxmox.com
Wed Jun 16 11:35:57 CEST 2021


the front end expects the error message to be the first part of the
last line. putting the new line at the beginning of the die message
does not work, either.

https://lists.proxmox.com/pipermail/pve-devel/2021-June/048676.html
---
 src/PVE/Tools.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index c90810c..3cf7c4d 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -1873,7 +1873,8 @@ sub download_file_from_url {
 		return;
 	    } else {
 		# we could re-download, but may not be safe so just abort for now..
-		die "mismatch (got '$checksum_got' != expect '$checksum_expected'), aborting\n";
+		print "\n";  # the front end expects the error to reside at the last line without any noise
+		die "checksum mismatch: got '$checksum_got' != expect '$checksum_expected', aborting\n";
 	    }
 	}
 
@@ -1908,7 +1909,8 @@ sub download_file_from_url {
 	    if (lc($checksum_got) eq lc($checksum_expected)) {
 		print "OK, checksum verified\n";
 	    } else {
-		die "ERROR, checksum mismatch: got '$checksum_got' != expect '$checksum_expected'\n";
+		print "\n";  # the front end expects the error to reside at the last line without any noise
+		die "checksum mismatch: got '$checksum_got' != expect '$checksum_expected'\n";
 	    }
 	}
 
-- 
2.20.1






More information about the pve-devel mailing list