index 4a7e8ce8803c228a598ca47d69d93081f78ee7e8..64b014917eb432ef4b68ebbca2eeb3fba5906ca4 100644 (file)
my ($error, $result, $event_hash) = &import_events($event_dir);
foreach my $log_line (@$result) {
if ($log_line =~ / succeed: /) {
- &main::daemon_log("0 DEBUG: GosaPackages - $log_line", 7);
+ &main::daemon_log("0 INFO: GosaPackages - $log_line", 5);
} else {
&main::daemon_log("0 ERROR: GosaPackages - $log_line", 1);
}
my @msg_l;
my @out_msg_l;
- &main::daemon_log("$session_id DEBUG: GosaPackages: msg to process '$header'", 7);
+ &main::daemon_log("$session_id DEBUG: GosaPackages: msg to process '$header'", 26);
if ($header =~ /^job_/) {
@msg_l = &process_job_msg($msg, $msg_hash, $session_id);
# check local installed events
if( exists $event2module_hash->{$header} ) {
# a event exists with the header as name
- &main::daemon_log("$session_id INFO: found event '$header' at event-module '".$event2module_hash->{$header}."'", 5);
+ &main::daemon_log("$session_id DEBUG: found event '$header' at event-module '".$event2module_hash->{$header}."'", 26);
no strict 'refs';
@out_msg_l = &{$event2module_hash->{$header}."::$header"}( $msg, $msg_hash, $session_id );
# client is registered for this event, deliver this message to client
if (($client_events =~ /^$header,/) || ($client_events =~ /,$header,/) || ($client_events =~ /,$header$/)) {
- &main::daemon_log("$session_id INFO: client '$target' is registerd for event '$header', forward message to client.", 5);
+ &main::daemon_log("$session_id DEBUg: client '$target' is registerd for event '$header', forward message to client.", 26);
@out_msg_l = ( $msg );
# client is not registered for this event, set error
&main::daemon_log("$session_id ERROR: GosaPackages: no event handler or core function defined for '$header'", 1);
@out_msg_l = ();
} elsif ($out_msg_l[0] eq 'knownclienterror') {
- &main::daemon_log("$session_id ERROR: no event handler found for '$header', check client registration events!", 1);
- &main::daemon_log("$session_id ERROR: no or more than 1 hits are found at known_clients_db with sql query: '$sql_events'", 1);
- &main::daemon_log("$session_id ERROR: processing is aborted and message will not be forwarded", 1);
+ if ($header eq "ping") {
+ &main::daemon_log("$session_id WARNING: Cannot send '$header' to '$target'. GOsa-si do not know client. Maybe client is offline or gosa-si-client process is not running.", 3);
+ } else {
+ &main::daemon_log("$session_id ERROR: no general event handler found for '$header', check client registration events!", 1);
+ &main::daemon_log("$session_id ERROR: no or more than 1 hits are found at known_clients_db with sql query: '$sql_events'", 1);
+ &main::daemon_log("$session_id ERROR: processing is aborted and message will not be forwarded", 1);
+ }
@out_msg_l = ();
} elsif ($out_msg_l[0] eq 'noeventerror') {
+ &main::daemon_log("$session_id ERROR: no general event handler found for '$header', check client registration events!", 1);
&main::daemon_log("$session_id ERROR: client '$target' is not registered for event '$header', processing is aborted", 1);
@out_msg_l = ();
}
"<answer1>1</answer1>".
"<error_string>no mac address specified, neither in target-tag nor in macaddres-tag</error_string>".
"</xml>";
+
+ return ($out_msg);
}
# Determine plain_name for host
&main::release_ldap_handle($ldap_handle);
}
+ # Check if it is a periodical job
+ my $periodic = 'none';
+ if (exists $msg_hash->{periodic})
+ {
+ $periodic = $msg_hash->{periodic}[0];
+ if (not $periodic =~ /[0-9]+_(hours|minutes|days|weeks|months)/) # Periodic tag is not valid
+ {
+ &main::daemon_log("$session_id ERROR: Message contains invalid periodic-tag '$periodic'.".
+ " Please use the following pattern for the tag: 'INTEGER_[minutes|hours|days|weeks|months]'".
+ " Aborted message: $msg", 1);
+ $out_msg = "<xml>".
+ "<header>answer</header><source>$main::server_address</source><target>GOSA</target>".
+ "<answer1>1</answer1><error_string>Message contains invalid periodic-tag '$periodic'</error_string>".
+ "</xml>";
+ return ($out_msg);
+ }
+ }
+
# Add job to job queue
if( $error == 0 ) {
my $func_dic = {table=>$main::job_queue_tn,
plainname=>$plain_name,
siserver=>"localhost",
modified=>"1",
+ periodic=>$periodic,
};
my $res = $main::job_db->add_dbentry($func_dic);
if (not $res == 0) {