Skip to content

Commit

Permalink
Update for issues with Proxmox 7.
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
TheGrandWazoo committed Aug 8, 2021
1 parent 572c81a commit 55f699e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions perl5/PVE/Storage/LunCmd/FreeNAS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 55f699e

Please sign in to comment.