From 12ee3eafe11c7a019cfc966bdab1e53a527473d6 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Mon, 28 Oct 2013 15:03:00 +0000 Subject: [PATCH] 2013-10-28 Sergio Martin * lib/PandoraFMS/DataServer.pm: Add check to update adopted unlinked data modules git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8971 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 +++++ pandora_server/lib/PandoraFMS/DataServer.pm | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 59fdceb4e9..7fda864a79 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2013-10-28 Sergio Martin + + * lib/PandoraFMS/DataServer.pm: Add check to update + adopted unlinked data modules + 2013-10-28 Sergio Martin * lib/PandoraFMS/Tools.pm: Added exeptions in safe_input diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index 8c78eb2fdd..fc09edbef7 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -632,9 +632,17 @@ sub process_module_data ($$$$$$$$$) { $module_conf->{'extended_info'} = $module->{'extended_info'} unless defined ($module_conf->{'extended_info'}); $module_conf->{'module_interval'} = $module->{'module_interval'} unless defined ($module_conf->{'module_interval'}); } - + + # Check if the module is policy linked to update it or not + my $policy_linked = 0; + if ($module->{'id_policy_module'} != 0) { + if ($module->{'policy_adopted'} == 0 || ($module->{'policy_adopted'} == 1 && $module->{'policy_linked'} == 1)) { + $policy_linked = 1; + } + } + # Update module configuration if in learning mode and not a policy module - if ($agent->{'modo'} eq '1' && $module->{'id_policy_module'} == 0) { + if ($agent->{'modo'} eq '1' && $policy_linked == 0) { update_module_configuration ($pa_config, $dbh, $module, $module_conf); }