From 1e6f3a9d9bbd13465f4c95dee3b660082b3f0d79 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 10 Oct 2017 11:44:15 +0200 Subject: [PATCH] Borja fix this error --- pandora_server/lib/PandoraFMS/DataServer.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index e005a1135a..ebd8f860ee 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -606,7 +606,8 @@ sub process_module_data ($$$$$$$$$$) { 'str_warning' => '', 'str_critical' => '', 'critical_instructions' => '', 'warning_instructions' => '', 'unknown_instructions' => '', 'tags' => '', 'critical_inverse' => 0, 'warning_inverse' => 0, 'quiet' => 0, 'module_ff_interval' => 0, 'alert_template' => '', 'crontab' => '', 'min_ff_event_normal' => 0, - 'min_ff_event_warning' => 0, 'min_ff_event_critical' => 0, 'ff_timeout' => 0, 'each_ff' => 0, 'module_parent' => 0}; + 'min_ff_event_warning' => 0, 'min_ff_event_critical' => 0, 'ff_timeout' => 0, 'each_ff' => 0, 'module_parent' => 0, + 'module_parent_unlink' => 0}; # Other tags will be saved here $module_conf->{'extended_info'} = ''; @@ -718,12 +719,19 @@ sub process_module_data ($$$$$$$$$$) { my $module_parent = $module_conf->{'module_parent'}; delete $module_conf->{'module_parent'}; + # module_parent_unlink is a special case. It is not stored in the DB, but we will need it later. + my $module_parent_unlink = $module_conf->{'module_parent_unlink'}; + delete $module_conf->{'module_parent_unlink'}; + # Create the module my $module_id = pandora_create_module_from_hash ($pa_config, $module_conf, $dbh); # Restore module_parent. $module_conf->{'module_parent'} = $module_parent; + # Restore module_parent_unlink. + $module_conf->{'module_parent_unlink'} = $module_parent_unlink; + $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND ' . db_text('nombre') . ' = ?', $agent->{'id_agente'}, safe_input($module_name)); if (! defined ($module)) { logger($pa_config, "Could not create module '$module_name' for agent '$agent_name'.", 3);