From 121c3a1af8a6a4e5649b869ac476e10111b536ec Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Thu, 6 Oct 2016 15:16:55 +0200 Subject: [PATCH] Prevent two agents from being each other's parents. --- pandora_server/util/recon_scripts/snmp-recon.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandora_server/util/recon_scripts/snmp-recon.pl b/pandora_server/util/recon_scripts/snmp-recon.pl index 9d269d1b6b..7195b4073d 100755 --- a/pandora_server/util/recon_scripts/snmp-recon.pl +++ b/pandora_server/util/recon_scripts/snmp-recon.pl @@ -997,10 +997,14 @@ sub connect_pandora_agents($$$$) { } # Update parents. - if (!defined($PARENTS{$agent_2->{'id_agente'}})) { + if (!defined($PARENTS{$agent_2->{'id_agente'}}) && + (!defined($PARENTS{$agent_1->{'id_agente'}}) || + $PARENTS{$agent_1->{'id_agente'}} != $agent_2->{'id_agente'})) { $PARENTS{$agent_2->{'id_agente'}} = $agent_1->{'id_agente'}; db_do($DBH, 'UPDATE tagente SET id_parent=? WHERE id_agente=?', $agent_1->{'id_agente'}, $agent_2->{'id_agente'}); - } elsif (!defined($PARENTS{$agent_1->{'id_agente'}})) { + } elsif (!defined($PARENTS{$agent_1->{'id_agente'}}) && + (!defined($PARENTS{$agent_2->{'id_agente'}}) || + $PARENTS{$agent_2->{'id_agente'}} != $agent_1->{'id_agente'})) { $PARENTS{$agent_1->{'id_agente'}} = $agent_2->{'id_agente'}; db_do($DBH, 'UPDATE tagente SET id_parent=? WHERE id_agente=?', $agent_2->{'id_agente'}, $agent_1->{'id_agente'}); }