From 55f699e0b137ad4d63c1a73db6238720eb86737c Mon Sep 17 00:00:00 2001 From: Kevin Scott Adams Date: Sun, 8 Aug 2021 09:30:49 -0400 Subject: [PATCH] Update for issues with Proxmox 7. - The eval{} block was originally returning a value that would allow execution in the $@ conditional. This changed between Proxmox 6 and 7. Why, no idea at the moment. Also, the original HASH was no longer valid as a variable. I don't like the code block at this moment, I need to do some regression testing to Proxmox 5 and FreeNAS/TrueNAS 11 and 12 to see if I can clean up the conditional block. It was there for a reason I just don't know at this moment. --- perl5/PVE/Storage/LunCmd/FreeNAS.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/perl5/PVE/Storage/LunCmd/FreeNAS.pm b/perl5/PVE/Storage/LunCmd/FreeNAS.pm index 08786b4..e1309cb 100644 --- a/perl5/PVE/Storage/LunCmd/FreeNAS.pm +++ b/perl5/PVE/Storage/LunCmd/FreeNAS.pm @@ -395,11 +395,13 @@ sub freenas_api_check { $result = decode_json($freenas_rest_connection->responseContent()); }; if ($@) { - $result->{'fullversion'} = $freenas_rest_connection->responseContent(); - $result->{'fullversion'} =~ s/^"//g; + $result = $freenas_rest_connection->responseContent(); + } else { + $result = $freenas_rest_connection->responseContent(); } - syslog("info", (caller(0))[3] . " : successful : Server version: " . $result->{'fullversion'}); - $result->{'fullversion'} =~ s/^((?!\-\d).*)\-(\d+)\.(\d+)\-([A-Za-z]*)(?(?=\-)\-(\d*)\-(\d*)|(\d?)\.?(\d?))//; + $result =~ s/^"//g; + syslog("info", (caller(0))[3] . " : successful : Server version: " . $result); + $result =~ s/^((?!\-\d).*)\-(\d+)\.(\d+)\-([A-Za-z]*)(?(?=\-)\-(\d*)\-(\d*)|(\d?)\.?(\d?))//; $product_name = $1; my $freenas_version = sprintf("%02d%02d%02d%02d", $2, $3 || 0, $7 || 0, $8 || 0); syslog("info", (caller(0))[3] . " : ". $product_name . " Unformatted Version: " . $freenas_version);