From c7f01812095b7790e34d8593c9863e72a6325aeb Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 30 Apr 2020 16:53:45 +0200 Subject: [PATCH 1/3] fix --- pandora_server/lib/PandoraFMS/Recon/Base.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/Recon/Base.pm b/pandora_server/lib/PandoraFMS/Recon/Base.pm index bbe7802097..a7cc451cc9 100644 --- a/pandora_server/lib/PandoraFMS/Recon/Base.pm +++ b/pandora_server/lib/PandoraFMS/Recon/Base.pm @@ -1358,7 +1358,7 @@ sub prepare_agent($$) { $self->{'agents_found'} = {} if ref($self->{'agents_found'}) ne 'HASH'; # Already initialized. - return if ref($self->{'agents_found'}->{$host_name}) eq 'HASH'; + return if ref($self->{'agents_found'}->{$addr}) eq 'HASH'; my @addresses = $self->get_addresses($addr); $self->{'agents_found'}->{$addr} = { From eaf10f7d6ec52a72fa410fd7dff42548e1cf7f9e Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 30 Apr 2020 18:07:52 +0200 Subject: [PATCH 2/3] weird json --- pandora_server/lib/PandoraFMS/Tools.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index 4b1486f0ef..c95324e79d 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -2390,12 +2390,12 @@ sub p_encode_json { ################################################################################ sub p_decode_json { my ($pa_config, $data) = @_; - - # Initialize JSON manager. - my $json = JSON->new->allow_nonref; my $decoded_data; if ($JSON::VERSION > 2.90) { + # Initialize JSON manager. + my $json = JSON->new->allow_nonref; + $decoded_data = $json->decode($data); } else { if (!is_empty($decoded_data)) { From 55392bac47622ebe039dd02801ba24b0cd369587 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 30 Apr 2020 18:11:50 +0200 Subject: [PATCH 3/3] weird json --- pandora_server/lib/PandoraFMS/Tools.pm | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index c95324e79d..cf9f01f5e1 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -2391,17 +2391,14 @@ sub p_encode_json { sub p_decode_json { my ($pa_config, $data) = @_; my $decoded_data; - - if ($JSON::VERSION > 2.90) { + + if ($JSON::VERSION > 2.90) { # Initialize JSON manager. my $json = JSON->new->allow_nonref; - - $decoded_data = $json->decode($data); - } else { - if (!is_empty($decoded_data)) { - $decoded_data = decode_json($data); - } - } + $decoded_data = $json->decode($data); + } else { + $decoded_data = decode_json($data); + } return $decoded_data; }