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.
This commit is contained in:
Kevin Scott Adams 2021-08-08 09:30:49 -04:00
parent 572c81a95e
commit 55f699e0b1
1 changed files with 6 additions and 4 deletions

View File

@ -395,11 +395,13 @@ sub freenas_api_check {
$result = decode_json($freenas_rest_connection->responseContent()); $result = decode_json($freenas_rest_connection->responseContent());
}; };
if ($@) { if ($@) {
$result->{'fullversion'} = $freenas_rest_connection->responseContent(); $result = $freenas_rest_connection->responseContent();
$result->{'fullversion'} =~ s/^"//g; } else {
$result = $freenas_rest_connection->responseContent();
} }
syslog("info", (caller(0))[3] . " : successful : Server version: " . $result->{'fullversion'}); $result =~ s/^"//g;
$result->{'fullversion'} =~ s/^((?!\-\d).*)\-(\d+)\.(\d+)\-([A-Za-z]*)(?(?=\-)\-(\d*)\-(\d*)|(\d?)\.?(\d?))//; syslog("info", (caller(0))[3] . " : successful : Server version: " . $result);
$result =~ s/^((?!\-\d).*)\-(\d+)\.(\d+)\-([A-Za-z]*)(?(?=\-)\-(\d*)\-(\d*)|(\d?)\.?(\d?))//;
$product_name = $1; $product_name = $1;
my $freenas_version = sprintf("%02d%02d%02d%02d", $2, $3 || 0, $7 || 0, $8 || 0); 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); syslog("info", (caller(0))[3] . " : ". $product_name . " Unformatted Version: " . $freenas_version);