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); }