From a75964fcbac380a2cbcc201589764fb3db532c15 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 8 Apr 2020 16:06:39 +0200 Subject: [PATCH] minor fix --- pandora_console/extras/mr/37.sql | 2 +- .../extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 2 +- pandora_console/pandoradb.sql | 2 +- pandora_server/lib/PandoraFMS/Recon/Base.pm | 7 +++++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pandora_console/extras/mr/37.sql b/pandora_console/extras/mr/37.sql index 8d29b06a53..40aa379f3a 100644 --- a/pandora_console/extras/mr/37.sql +++ b/pandora_console/extras/mr/37.sql @@ -2,7 +2,7 @@ START TRANSACTION; ALTER TABLE trecon_task MODIFY COLUMN `id_network_profile` TEXT; ALTER TABLE `trecon_task` CHANGE COLUMN `create_incident` `review_mode` TINYINT(1) UNSIGNED DEFAULT 0; -ALTER TABLE `trecon_task` ADD COLUMN `subnet_csv` TINYINT(1) UNSIGNED DEFAULT 0; +ALTER TABLE `trecon_task` ADD COLUMN `subnet_csv` TINYINT(1) UNSIGNED DEFAULT 1; UPDATE `trecon_task` SET `review_mode` = 1; ALTER TABLE trecon_task add column `auto_monitor` TINYINT(1) UNSIGNED DEFAULT 1 AFTER `auth_strings`; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 6dce97ee8a..c6972632b8 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1685,7 +1685,7 @@ ALTER TABLE `trecon_task` ADD COLUMN `type` int(11) NOT NULL DEFAULT '0', MODIFY COLUMN `autoconfiguration_enabled` tinyint(1) unsigned NULL DEFAULT '0', MODIFY COLUMN `summary` text NULL, MODIFY COLUMN `id_network_profile` text, - CHANGE COLUMN `create_incident` `review_mode` TINYINT(1) UNSIGNED DEFAULT 0, + CHANGE COLUMN `create_incident` `review_mode` TINYINT(1) UNSIGNED DEFAULT 1, ADD COLUMN `subnet_csv` TINYINT(1) UNSIGNED DEFAULT 0; -- Old recon always report. diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 83b842eee3..a58b0a6320 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -774,7 +774,7 @@ CREATE TABLE IF NOT EXISTS `trecon_task` ( `description` varchar(250) NOT NULL default '', `subnet` text NOT NULL, `id_network_profile` text, - `review_mode` tinyint(1) unsigned NOT NULL default 0, + `review_mode` tinyint(1) unsigned NOT NULL default 1, `id_group` int(10) unsigned NOT NULL default 1, `utimestamp` bigint(20) unsigned NOT NULL default 0, `status` tinyint(4) NOT NULL default 0, diff --git a/pandora_server/lib/PandoraFMS/Recon/Base.pm b/pandora_server/lib/PandoraFMS/Recon/Base.pm index 20a31da76b..0c89e3060e 100644 --- a/pandora_server/lib/PandoraFMS/Recon/Base.pm +++ b/pandora_server/lib/PandoraFMS/Recon/Base.pm @@ -1341,7 +1341,10 @@ sub prepare_agent($$) { ################################################################################ sub add_agent($$) { my ($self, $addr) = @_; - + + # Avoid create empty agents. + return if is_empty($addr); + $self->prepare_agent($addr); } @@ -2141,7 +2144,7 @@ sub traceroute_connectivity($$) { # Look for parents. my $device = $host; for (my $i = 0; $i < $self->{'parent_recursion'}; $i++) { - next unless defined($hops[$i]); + next if is_empty($hops[$i]); my $parent = $hops[$i]->ipaddr(); # Create an agent for the parent.