Fixed the lost config data in modules from policy when update something in the module. TICKET: #1874

This commit is contained in:
mdtrooper 2015-03-04 14:55:44 +01:00
parent b79d572959
commit 50bbdf5590

View File

@ -781,6 +781,8 @@ $edit_module = (bool) get_parameter ('edit_module');
if ($update_module || $create_module) {
$id_grupo = agents_get_agent_group ($id_agente);
$id_agent_module = (int) get_parameter ('id_agent_module');
if (!check_acl ($config["id_user"], $id_grupo, "AW")) {
db_pandora_audit("ACL Violation",
"Trying to create a module without admin rights");
@ -947,9 +949,10 @@ if ($update_module || $create_module) {
$wday = get_parameter('wday');
$cron_interval = "$minute $hour $mday $month $wday";
if ($prediction_module != 3) {
if ($prediction_module != MODULE_PREDICTION_SYNTHETIC) {
unset($serialize_ops);
enterprise_hook('modules_delete_synthetic_operations', array($id_agent_module));
enterprise_hook('modules_delete_synthetic_operations',
array($id_agent_module));
}
$active_snmp_v3 = get_parameter('active_snmp_v3');
@ -968,8 +971,11 @@ if ($update_module || $create_module) {
// Make changes in the conf file if necessary
enterprise_include_once('include/functions_config_agents.php');
if (!policies_is_module_in_policy($id_agent_module)) {
enterprise_hook('config_agents_write_module_in_conf',
array($id_agente, io_safe_output($old_configuration_data), io_safe_output($configuration_data), $disabled));
array($id_agente, io_safe_output($old_configuration_data),
io_safe_output($configuration_data), $disabled));
}
}
// MODULE UPDATE
@ -1038,7 +1044,9 @@ if ($update_module) {
unset($values['module_interval']);
}
if ($prediction_module == 3 && $serialize_ops == '') {
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC &&
$serialize_ops == '') {
$result = false;
}
else {