From f5f04a5521a10b4d41fd64b5029805c197d9d2fc Mon Sep 17 00:00:00 2001 From: rettenbe Date: Thu, 4 Jun 2009 08:02:37 +0000 Subject: [PATCH] * changing log line level git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13693 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-server | 62 +++++++++++++--------------- gosa-si/modules/ClientPackages.pm | 61 ++++++++++++++------------- gosa-si/modules/DBsqlite.pm | 61 ++++----------------------- gosa-si/modules/GosaPackages.pm | 8 ++-- gosa-si/modules/GosaSupportDaemon.pm | 2 +- gosa-si/modules/ServerPackages.pm | 6 +-- gosa-si/tests/client.php | 36 +++++++--------- 7 files changed, 91 insertions(+), 145 deletions(-) diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index d391e2de7..3bce9a9b7 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -315,7 +315,10 @@ usage: $prg [-hvf] [-c config] [-d number] 2 : sending messages 4 : encrypting/decrypting messages 8 : verification if a message complies gosa-si requirements - 16 : + 16 : message processing + 32 : ldap connectivity + 64 : database status and connectivity + 128 : main process EOF print "\n" ; @@ -1014,8 +1017,8 @@ sub send_msg_to_target { sub update_jobdb_status_for_send_msgs { my ($session_id, $answer, $error) = @_; - &daemon_log("$session_id DEBUG: try to update job status", 7); if( $answer =~ /(\d+)<\/jobdb_id>/ ) { + &daemon_log("$session_id DEBUG: try to update job status", 138); my $jobdb_id = $1; $answer =~ /
(.*)<\/header>/; @@ -1033,7 +1036,6 @@ sub update_jobdb_status_for_send_msgs { ||($job_header eq "trigger_action_halt") ) { my $sql_statement = "UPDATE $job_queue_tn SET status='done' WHERE id=$jobdb_id"; - &daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $job_db->update_dbentry($sql_statement); # Reactivate jobs, jobs need to deliver their message @@ -1049,7 +1051,6 @@ sub update_jobdb_status_for_send_msgs { my $sql_statement = "UPDATE $job_queue_tn ". "SET status='error', result='can not deliver msg, please consult log file' ". "WHERE id=$jobdb_id"; - &daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $job_db->update_dbentry($sql_statement); } @@ -1069,14 +1070,13 @@ sub update_jobdb_status_for_send_msgs { my $sql_statement = "UPDATE $job_queue_tn ". "SET status='done' ". "WHERE id=$jobdb_id AND status='processed'"; - &daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $job_db->update_dbentry($sql_statement); } else { - &daemon_log("$session_id DEBUG: sending message succeed but cannot update job status.", 7); + &daemon_log("$session_id DEBUG: sending message succeed but cannot update job status.", 138); } } } else { - &daemon_log("$session_id DEBUG: cannot update job status, msg has no jobdb_id-tag.", 7); + &daemon_log("$session_id DEBUG: cannot update job status, msg has no jobdb_id-tag.", 138); } } @@ -1091,7 +1091,6 @@ sub reactivate_job_with_delay { my $res = $job_db->update_dbentry($sql); daemon_log("$session_id INFO: '$header'-job will be reactivated at '$delay_timestamp' ". "cause client '$target' is currently not available", 5); - daemon_log("$session_id $sql", 7); return; } @@ -1504,17 +1503,19 @@ sub process_task { # process incoming msg if( $error == 0) { daemon_log("$session_id INFO: Incoming msg (session_id=$session_id) with header '".@{$msg_hash->{'header'}}[0]."'", 5); - daemon_log("$session_id DEBUG: Processing module ".$module, 7); + daemon_log("$session_id DEBUG: Processing module ".$module, 26); $answer_l = &{ $module."::process_incoming_msg" }($msg, $msg_hash, $session_id); if ( 0 < @{$answer_l} ) { my $answer_str = join("\n", @{$answer_l}); + my @headers; while ($answer_str =~ /
(\w+)<\/header>/g) { - daemon_log("$session_id INFO: got answer message with header '$1'", 5); + push(@headers, $1); } - daemon_log("$session_id DEBUG: $module: got answer from module: \n".$answer_str,9); + daemon_log("$session_id INFO: got answer message(s) with header: '".join("', '", @headers)."'", 5); + daemon_log("$session_id DEBUG: $module: got answer from module: \n".$answer_str,26); } else { - daemon_log("$session_id DEBUG: $module: got no answer from module!" ,7); + daemon_log("$session_id DEBUG: $module: got no answer from module!" ,26); } } @@ -2049,7 +2050,6 @@ sub watch_for_delivery_messages { # select outgoing messages my $sql_statement = "SELECT * FROM $messaging_tn WHERE ( flag='p' AND direction='out' )"; - #&daemon_log("0 DEBUG: $sql", 7); my $res = $messaging_db->exec_statement( $sql_statement ); # build out msg for each usr @@ -2061,7 +2061,6 @@ sub watch_for_delivery_messages { # resolve usr -> host where usr is logged in my $sql = "SELECT * FROM $login_users_tn WHERE (user='$receiver')"; - #&daemon_log("0 DEBUG: $sql", 7); my $res = $login_users_db->exec_statement($sql); # receiver is logged in nowhere @@ -2151,21 +2150,18 @@ sub watch_for_done_messages { my ($kernel,$heap) = @_[KERNEL, HEAP]; my $sql = "SELECT * FROM $messaging_tn WHERE (flag='p' AND direction='in')"; - #&daemon_log("0 DEBUG: $sql", 7); my $res = $messaging_db->exec_statement($sql); foreach my $hit (@{$res}) { my $msg_id = @{$hit}[0]; my $sql = "SELECT * FROM $messaging_tn WHERE (id='$msg_id' AND direction='out' AND (NOT flag='s'))"; - #&daemon_log("0 DEBUG: $sql", 7); my $res = $messaging_db->exec_statement($sql); # not all usr msgs have been seen till now if ( ref(@$res[0]) eq "ARRAY") { next; } $sql = "DELETE FROM $messaging_tn WHERE (id='$msg_id')"; - #&daemon_log("0 DEBUG: $sql", 7); $res = $messaging_db->exec_statement($sql); } @@ -2224,7 +2220,7 @@ sub watch_for_next_tasks { } my $message_id = $hit->{'id'}; my $session_id = $hit->{'sessionid'}; - &daemon_log("$session_id DEBUG: start processing for message with incoming id: '$message_id'", 7); + &daemon_log("$session_id DEBUG: start processing for message with incoming id: '$message_id'", 11); $kernel->yield('next_task', $hit); @@ -2248,7 +2244,7 @@ sub get_ldap_handle { if ($subroutine eq "(eval)") { $caller_text = "eval block within file '$file' for '$evalText'"; } - daemon_log("$session_id INFO: new ldap handle for '$caller_text' required!", 7); + daemon_log("$session_id DEBUG: new ldap handle for '$caller_text' required!", 42); get_handle: my $ldap_handle = Net::LDAP->new( $ldap_uri ); @@ -2257,7 +2253,7 @@ get_handle: usleep(100000); goto get_handle; } else { - daemon_log("$session_id DEBUG: Connection to LDAP URI '$ldap_uri' established.", 6); + daemon_log("$session_id DEBUG: Connection to LDAP URI '$ldap_uri' established.", 42); } $ldap_handle->bind($ldap_admin_dn, password => $ldap_admin_password) or &daemon_log("$session_id ERROR: Could not bind as '$ldap_admin_dn' to LDAP URI '$ldap_uri'!", 1); @@ -2266,11 +2262,13 @@ get_handle: sub release_ldap_handle { - my ($ldap_handle) = @_ ; + my ($ldap_handle, $session_id) = @_ ; + if (not defined $session_id ) { $session_id = 0 }; + if(ref $ldap_handle) { $ldap_handle->disconnect(); } - &main::daemon_log("0 DEBUG: Released a ldap handle!", 6); + &main::daemon_log("$session_id DEBUG: Released a ldap handle!", 42); return; } @@ -2348,13 +2346,13 @@ sub change_fai_state { daemon_log("$session_id Error: Setting FAIstate to '$state' for ".$entry->dn. "failed: ".$result->error, 1); } } else { - daemon_log("$session_id DEBUG FAIstate at host '".$entry->dn."' already at state '$st'", 7); + daemon_log("$session_id DEBUG FAIstate at host '".$entry->dn."' already at state '$st'", 42); } } } else { daemon_log("$session_id ERROR: LDAP search failed: ldap_base=$ldap_base, filter=$search", 1); } - &release_ldap_handle($ldap_handle); + &release_ldap_handle($ldap_handle, $session_id); return; } @@ -2414,7 +2412,7 @@ sub change_goto_state { } } - &release_ldap_handle($ldap_handle); + &release_ldap_handle($ldap_handle, $session_id); return; } @@ -2524,7 +2522,7 @@ sub create_fai_release_db { ); if(($mesg->code == 0) && ($mesg->count != 0)) { - daemon_log("$session_id DEBUG: create_fai_release_db: count " . $mesg->count,8); + daemon_log("$session_id DEBUG: create_fai_release_db: count " . $mesg->count,138); # Walk through all possible FAI container ou's my @sql_list; @@ -2551,14 +2549,14 @@ sub create_fai_release_db { } } - daemon_log("$session_id DEBUG: create_fai_release_db: Inserting ".scalar @sql_list." entries to DB",8); + daemon_log("$session_id DEBUG: create_fai_release_db: Inserting ".scalar @sql_list." entries to DB",138); &release_ldap_handle($ldap_handle); if(@sql_list) { unshift @sql_list, "VACUUM"; unshift @sql_list, "DELETE FROM $table_name"; $fai_release_db->exec_statementlist(\@sql_list); } - daemon_log("$session_id DEBUG: create_fai_release_db: Done with inserting",7); + daemon_log("$session_id DEBUG: create_fai_release_db: Done with inserting",138); } else { daemon_log("$session_id INFO: create_fai_release_db: error: " . $mesg->code, 5); } @@ -2608,14 +2606,14 @@ sub resolve_fai_classes { my $fai_filter= "(|(&(objectClass=FAIclass)(|(objectClass=".join(")(objectClass=", @possible_fai_classes).")))(objectClass=FAIbranch))"; my $fai_classes; - daemon_log("$session_id DEBUG: Searching for FAI entries in base $fai_base",7); + daemon_log("$session_id DEBUG: Searching for FAI entries in base $fai_base", 138); my $mesg= $ldap_handle->search( base => $fai_base, scope => 'sub', attrs => ['cn','objectClass','FAIstate'], filter => $fai_filter, ); - daemon_log("$session_id DEBUG: Found ".$mesg->count()." FAI entries",7); + daemon_log("$session_id DEBUG: Found ".$mesg->count()." FAI entries", 138); if($mesg->{'resultCode'} == 0 && $mesg->count != 0) { @@ -3249,12 +3247,10 @@ sub register_at_foreign_servers { # block them for race conditional registration processes of other si-servers. my $act_time = &get_time(); my $block_statement = "UPDATE $known_server_tn SET status='new_server',update_time='19700101000000' WHERE (CAST(update_time AS UNSIGNED))<$act_time "; - &daemon_log("0 DEBUG: $block_statement", 7); my $block_res = $known_server_db->exec_statement($block_statement); # Fetch all si-server from db where update_time is younger than act_time my $fetch_statement = "SELECT * FROM $known_server_tn WHERE update_time='19700101000000'"; - &daemon_log("0 DEBUG: $fetch_statement", 7); my $fetch_res = $known_server_db->exec_statement($fetch_statement); # Detect already connected clients. Will be added to registration msg later. @@ -3306,7 +3302,6 @@ sub control_server_registration { # Check if all registration processes succeed or not my $select_statement = "SELECT * FROM $known_server_tn WHERE status='new_server'"; - &daemon_log("0 DEBUG $select_statement", 7); my $select_res = $known_server_db->exec_statement($select_statement); # If at least one registration process failed, maybe in case of a race condition @@ -3316,7 +3311,6 @@ sub control_server_registration { # Release block statement 'new_server' to make the server accessible # for foreign registration processes my $update_statement = "UPDATE $known_server_tn SET status='waiting' WHERE status='new_server'"; - &daemon_log("0 DEBUG: $update_statement", 7); my $update_res = $known_server_db->exec_statement($update_statement); # Set a random delay to avoid the registration race condition diff --git a/gosa-si/modules/ClientPackages.pm b/gosa-si/modules/ClientPackages.pm index 9f4dea70b..1db6d0193 100644 --- a/gosa-si/modules/ClientPackages.pm +++ b/gosa-si/modules/ClientPackages.pm @@ -62,7 +62,7 @@ my ($error, $result, $event_hash) = &import_events($event_dir); foreach my $log_line (@$result) { if ($log_line =~ / succeed: /) { - &main::daemon_log("0 DEBUG: ClientPackages - $log_line", 7); + &main::daemon_log("0 INFO: ClientPackages - $log_line", 5); } else { &main::daemon_log("0 ERROR: ClientPackages - $log_line", 1); } @@ -157,7 +157,7 @@ $main::server_address = $server_address; # TODO: This should be transferred to a module init-function my $ldap_handle = &main::get_ldap_handle(); if( defined($ldap_handle) ) { - &main::daemon_log("0 DEBUG: Searching for ou=incoming container for new clients", 9); + &main::daemon_log("0 INFO: Searching for ou=incoming container for new clients", 5); # Perform search my $mesg = $ldap_handle->search( base => $ldap_base, @@ -303,14 +303,14 @@ sub process_incoming_msg { # skip PREFIX $header =~ s/^CLMSG_//; - &main::daemon_log("$session_id DEBUG: ClientPackages: msg to process: $header", 7); + &main::daemon_log("$session_id DEBUG: ClientPackages: msg to process: $header", 26); if( 0 == length @target_l){ &main::daemon_log("$session_id ERROR: no target specified for msg $header", 1); $error++; } elsif( 1 == length @target_l) { my $target = $target_l[0]; - if(&server_matches($target)) { + if(&server_matches($target, $session_id)) { if ($header eq 'new_key') { @out_msg_l = &new_key($msg_hash) } elsif ($header eq 'here_i_am') { @@ -318,7 +318,7 @@ sub process_incoming_msg { } else { # a event exists with the header as name if( exists $event2module_hash->{$header} ) { - &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); @@ -369,7 +369,7 @@ sub process_incoming_msg { @out_msg_l = (); } } else { - &main::daemon_log("INFO: msg is not for gosa-si-server '$server_address', deliver it to target '$target'", 5); + &main::daemon_log("DEBUG: msg is not for gosa-si-server '$server_address', deliver it to target '$target'", 26); push(@out_msg_l, $msg); } } @@ -469,16 +469,16 @@ sub here_i_am { my $db_res= $main::known_clients_db->select_dbentry( $sql_statement ); if ( 1 == keys %{$db_res} ) { - &main::daemon_log("$session_id WARNING: $source is already known as a client", 1); - &main::daemon_log("$session_id WARNING: values for $source are being overwritten", 1); + &main::daemon_log("$session_id WARNING: $source is already known as a client", 3); + &main::daemon_log("$session_id WARNING: values for $source are being overwritten", 3); $nu_clients --; } # number of current active clients my $act_nu_clients = $nu_clients; - &main::daemon_log("$session_id INFO: number of current active clients: $act_nu_clients", 5); - &main::daemon_log("$session_id INFO: number of maximal allowed clients: $max_clients", 5); + &main::daemon_log("$session_id DEBUG: number of current active clients: $act_nu_clients", 26); + &main::daemon_log("$session_id DEBUG: number of maximal allowed clients: $max_clients", 26); if($max_clients <= $act_nu_clients) { my $out_hash = &create_xml_hash("denied", $server_address, $source); @@ -506,7 +506,7 @@ sub here_i_am { } ); if ($res != 0) { - &main::daemon_log("$session_id ERROR: cannot add entry to known_clients: $res"); + &main::daemon_log("$session_id ERROR: cannot add entry to known_clients: $res",1); return; } @@ -526,7 +526,7 @@ sub here_i_am { "SET status='error', result='$new_ldap_config_out' ". "WHERE status='processing' AND macaddress LIKE '$mac_address'"; my $res = $main::job_db->update_dbentry($sql_statement); - &main::daemon_log("$session_id DEBUG: $sql_statement RESULT: $res", 7); + &main::daemon_log("$session_id DEBUG: $sql_statement RESULT: $res", 26); } my $register_out = &create_xml_string($out_hash); push(@out_msg_l, $register_out); @@ -559,8 +559,7 @@ sub here_i_am { my $mymsg = &build_msg('new_foreign_client', $main::server_address, "KNOWN_SERVER", \%mydata); push(@out_msg_l, $mymsg); - &main::daemon_log("$session_id INFO: register client $source ($mac_address)", 5); - &main::daemon_log("$session_id INFO: client version: $client_status - $client_revision", 5); + &main::daemon_log("$session_id INFO: register client $source ($mac_address), $client_status - $client_revision", 5); return @out_msg_l; } @@ -578,7 +577,7 @@ sub who_has { # what is your search pattern my $search_pattern = @{$msg_hash->{who_has}}[0]; my $search_element = @{$msg_hash->{$search_pattern}}[0]; - &main::daemon_log("who_has-msg looking for $search_pattern $search_element", 7); + #&main::daemon_log("who_has-msg looking for $search_pattern $search_element", 7); # scanning known_clients for search_pattern my @host_addresses = keys %$main::known_clients; @@ -625,7 +624,7 @@ sub new_syslog_config { attrs => ['gotoSyslogServer'], filter => "(&(objectClass=GOhard)(macaddress=$mac_address))"); if($ldap_res->code) { - &main::daemon_log("$session_id ".$ldap_res->error, 1); + &main::daemon_log("$session_id ERROR: new_syslog_config: ldap search: ".$ldap_res->error, 1); &main::release_ldap_handle($ldap_handle); return; } @@ -653,7 +652,7 @@ sub new_syslog_config { attrs => ['gotoSyslogServer'], filter => "(&(objectClass=gosaGroupOfNames)(member=$filter_dn))"); if($ldap_res->code) { - &main::daemon_log("$session_id ".$ldap_res->error, 1); + &main::daemon_log("$session_id ERROR: new_syslog_config: ldap search: ".$ldap_res->error, 1); &main::release_ldap_handle($ldap_handle); return; } @@ -701,7 +700,7 @@ sub new_ntp_config { attrs => ['gotoNtpServer'], filter => "(&(objectClass=GOhard)(macaddress=$address))"); if($ldap_res->code) { - &main::daemon_log("$session_id ".$ldap_res->error, 1); + &main::daemon_log("$session_id ERROR: new_ntp_config: ldap search: ".$ldap_res->error, 1); &main::release_ldap_handle($ldap_handle); return; } @@ -729,7 +728,7 @@ sub new_ntp_config { attrs => ['gotoNtpServer'], filter => "(&(objectClass=gosaGroupOfNames)(member=$filter_dn))"); if($ldap_res->code) { - &main::daemon_log("$session_id ".$ldap_res->error, 1); + &main::daemon_log("$session_id ERROR: new_ntp_config: ldap search: ".$ldap_res->error, 1); &main::release_ldap_handle($ldap_handle); return; } @@ -782,7 +781,7 @@ sub new_ldap_config { # check hit my $hit_counter = keys %{$res}; if( not $hit_counter == 1 ) { - &main::daemon_log("$session_id ERROR: more or no hit found in known_clients_db by query '$sql_statement'", 1); + &main::daemon_log("$session_id ERROR: new_ldap_config: more or no hit found in known_clients_db by query '$sql_statement'", 1); return; } @@ -791,7 +790,7 @@ sub new_ldap_config { my $hostkey = $res->{1}->{hostkey}; if (not defined $macaddress) { - &main::daemon_log("$session_id ERROR: no mac address found for client $address", 1); + &main::daemon_log("$session_id ERROR: new_ldap_config: no mac address found for client $address", 1); return; } @@ -802,7 +801,7 @@ sub new_ldap_config { attrs => ['dn', 'gotoLdapServer', 'gosaUnitTag', 'FAIclass'], filter => "(&(objectClass=GOhard)(macaddress=$macaddress))"); if($mesg->code) { - &main::daemon_log("$session_id ".$mesg->error, 1); + &main::daemon_log("$session_id ERROR: new_ldap_config: ldap search: ".$mesg->error, 1); &main::release_ldap_handle($ldap_handle); return; } @@ -841,14 +840,14 @@ sub new_ldap_config { attrs => ['dn', 'gotoLdapServer', 'FAIclass'], filter => "(&(objectClass=gosaGroupOfNames)(member=$filter_dn))"); if($mesg->code) { - &main::daemon_log("$session_id ERROR: unable to search for '(&(objectClass=gosaGroupOfNames)(member=$filter_dn))': ".$mesg->error, 1); + &main::daemon_log("$session_id ERROR: new_ldap_config: unable to search for '(&(objectClass=gosaGroupOfNames)(member=$filter_dn))': ".$mesg->error, 1); &main::release_ldap_handle($ldap_handle); return; } # Sanity check if ($mesg->count != 1) { - &main::daemon_log("$session_id ERROR: client with mac address $macaddress not found/unique/active - not sending ldap config". + &main::daemon_log("$session_id ERROR: new_ldap_config: client with mac address $macaddress not found/unique/active - not sending ldap config". "\n\tbase: $ldap_base". "\n\tscope: sub". "\n\tattrs: dn, gotoLdapServer, FAIclass". @@ -915,14 +914,14 @@ sub new_ldap_config { filter => "(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$unit_tag))"); #$mesg->code && die $mesg->error; if($mesg->code) { - &main::daemon_log($mesg->error, 1); + &main::daemon_log("$session_id ERROR: new_ldap_config: ldap search: ".$mesg->error, 1); &main::release_ldap_handle($ldap_handle); return "error-unit-tag-count-0"; } # Sanity check if ($mesg->count != 1) { - &main::daemon_log("WARNING: cannot find administrative unit for client with tag $unit_tag", 1); + &main::daemon_log("WARNING: cannot find administrative unit for client with tag $unit_tag", 3); &main::release_ldap_handle($ldap_handle); return "error-unit-tag-count-".$mesg->count; } @@ -959,13 +958,13 @@ sub hardware_config { # check hit my $hit_counter = keys %{$res}; if( not $hit_counter == 1 ) { - &main::daemon_log("$session_id ERROR: more or no hit found in known_clients_db by query by '$address'", 1); + &main::daemon_log("$session_id ERROR: hardware_config: more or no hit found in known_clients_db by query by '$address'", 1); } my $macaddress = $res->{1}->{macaddress}; my $hostkey = $res->{1}->{hostkey}; if (not defined $macaddress) { - &main::daemon_log("$session_id ERROR: no mac address found for client $address", 1); + &main::daemon_log("$session_id ERROR: hardware_config: no mac address found for client $address", 1); return; } @@ -978,7 +977,7 @@ sub hardware_config { ); if($mesg->count() == 0) { - &main::daemon_log("Host was not found in LDAP!", 1); + &main::daemon_log("$session_id INFO: Host was not found in LDAP!", 5); # set status = hardware_detection at jobqueue if entry exists # TODO @@ -1032,7 +1031,7 @@ sub hardware_config { } sub server_matches { - my $target = shift; + my ($target, $session_id) = @_ ; my $target_ip = ($1) if $target =~ /^([0-9\.]*?):.*$/; if(!defined($target_ip) or length($target_ip) == 0) { return; @@ -1076,7 +1075,7 @@ sub server_matches { } } } else { - &main::daemon_log("Target ip $target_ip does not match Server ip $server_ip",1); + &main::daemon_log("$session_id INFO: Target ip $target_ip does not match Server ip $server_ip",5); } return $result; diff --git a/gosa-si/modules/DBsqlite.pm b/gosa-si/modules/DBsqlite.pm index 21ad1f752..a67f7b4a2 100644 --- a/gosa-si/modules/DBsqlite.pm +++ b/gosa-si/modules/DBsqlite.pm @@ -29,7 +29,7 @@ sub new { my @ret = $sth->fetchall_arrayref(); $sth->finish(); if(length(@ret)==1 && $ret[0][0][0] eq 'ok') { - &main::daemon_log("0 DEBUG: Database disk image '".$self->{db_name}."' is ok.", 7); + &main::daemon_log("0 DEBUG: Database disk image '".$self->{db_name}."' is ok.", 74); } else { &main::daemon_log("0 ERROR: Database disk image '".$self->{db_name}."' is malformed, creating new database!", 1); $self->{dbh}->disconnect() or &main::daemon_log("0 ERROR: Could not disconnect from database '".$self->{db_name}."'!", 1); @@ -92,7 +92,7 @@ get_lock: goto get_lock; } else { seek($self->{db_lock_handle}, 0, 2); - &main::daemon_log("0 DEBUG: Acquired lock for database ".$self->{db_name}, 8); + &main::daemon_log("0 DEBUG: Acquired lock for database ".$self->{db_name}, 74); $self->connect(); } return; @@ -109,7 +109,7 @@ sub unlock { &main::daemon_log("0 BIG ERROR: Lockfile for database ".$self->{db_name}."got closed within critical section!", 1); } flock($self->{db_lock_handle}, LOCK_UN); - &main::daemon_log("0 DEBUG: Released lock for database ".$self->{db_name}, 8); + &main::daemon_log("0 DEBUG: Released lock for database ".$self->{db_name}, 74); $self->disconnect(); return; } @@ -153,49 +153,6 @@ sub create_table { } -# sub check_schema { -# my $self = shift; -# my $result = 1; -# if(not defined($self) or ref($self) ne 'GOSA::DBsqlite') { -# &main::daemon_log("0 ERROR: GOSA::DBsqlite::check_schema was called static! Argument was '$self'!", 1); -# return $result; -# } -# -# my $table_name = shift || undef; -# my $table_columns; -# -# if($table_name and $col_names->{$table_name}) { -# # Query the table_info from database -# foreach my $column ( @{ $self->exec_statement ( "pragma table_info('$table_name')" ) } ) { -# my $column_name = @$column[1]; -# my $data_type = @$column[2]; -# $table_columns->{$column_name}= $data_type; -# } -# -# foreach my $column (@{$col_names->{$table_name}}) { -# my ($column_name, $datatype) = split(/\s/, $column); -# if(exists($table_columns->{$column_name})) { -# if(lc $datatype eq lc $table_columns->{$column_name}) { -# next; -# } else { -# &main::daemon_log("WARNING: Column '$column_name' has wrong datatype!", 1); -# $result = 0; -# } -# } else { -# $result = 0; -# &main::daemon_log("WARNING: Column '$column_name' is missing!", 1); -# #&main::daemon_log("DEBUG Columns are not equal! Column '".$self->{db_name}.".$column_name' is missing!", 0); -# #my $sql_statement = "ALTER TABLE $table_name ADD COLUMN $column_name $datatype"; -# #$self->exec_statement($sql_statement); -# # The ALTER TABLE statement sucks completely in SQLite, so just recreate the table -# } -# } -# } -# -# return $result; -# } - - sub add_dbentry { my $self = shift; my $arg = shift; @@ -265,7 +222,7 @@ sub add_dbentry { my $sth = $self->{dbh}->prepare($sql_statement); $db_res = $sth->execute(); $sth->finish(); - &main::daemon_log("0 DEBUG: Execution of statement '$sql_statement' succeeded!", 9); + &main::daemon_log("0 DEBUG: Execution of statement '$sql_statement' succeeded!", 74); $success = 1; }; if($@) { @@ -279,7 +236,7 @@ sub add_dbentry { my $sth = $self->{dbh}->prepare($sql_statement); $db_res = $sth->execute(); $sth->finish(); - &main::daemon_log("0 DEBUG: Execution of statement '$sql_statement' succeeded!", 9); + &main::daemon_log("0 DEBUG: Execution of statement '$sql_statement' succeeded!", 74); $success = 1; }; if($@) { @@ -294,7 +251,7 @@ sub add_dbentry { my $sth = $self->{dbh}->prepare($sql_statement); $db_res = $sth->execute(); $sth->finish(); - &main::daemon_log("0 DEBUG: Execution of statement '$sql_statement' succeeded!", 7); + &main::daemon_log("0 DEBUG: Execution of statement '$sql_statement' succeeded!", 74); $success = 1; }; if($@) { @@ -456,7 +413,7 @@ sub exec_statement { @db_answer = @{$sth->fetchall_arrayref()}; $sth->finish(); $success=1; - &main::daemon_log("0 DEBUG: $sql_statement succeeded.", 9); + &main::daemon_log("0 DEBUG: $sql_statement succeeded.", 74); }; if($@) { eval { @@ -478,7 +435,7 @@ sub exec_statement { @db_answer = @{$sth->fetchall_arrayref()}; $sth->finish(); $success=1; - &main::daemon_log("0 DEBUG: $sql_statement succeeded.", 9); + &main::daemon_log("0 DEBUG: $sql_statement succeeded.", 74); }; if($@) { eval { @@ -501,7 +458,7 @@ sub exec_statement { @db_answer = @{$sth->fetchall_arrayref()}; $sth->finish(); DBI->trace(0); - &main::daemon_log("0 DEBUG: $sql_statement succeeded.", 9); + &main::daemon_log("0 DEBUG: $sql_statement succeeded.", 74); }; if($@) { DBI->trace(0); diff --git a/gosa-si/modules/GosaPackages.pm b/gosa-si/modules/GosaPackages.pm index 4a7e8ce88..ea5bc2a51 100644 --- a/gosa-si/modules/GosaPackages.pm +++ b/gosa-si/modules/GosaPackages.pm @@ -37,7 +37,7 @@ $main::server_address = $main::server_ip.":".$main::server_port; 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); } @@ -114,7 +114,7 @@ sub process_incoming_msg { 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); @@ -167,7 +167,7 @@ sub process_gosa_msg { # 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 ); @@ -186,7 +186,7 @@ sub process_gosa_msg { # 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 diff --git a/gosa-si/modules/GosaSupportDaemon.pm b/gosa-si/modules/GosaSupportDaemon.pm index 9b156820c..526afd36c 100644 --- a/gosa-si/modules/GosaSupportDaemon.pm +++ b/gosa-si/modules/GosaSupportDaemon.pm @@ -528,7 +528,7 @@ sub import_events { # Check config file to exclude disabled event plugins (i.e. Opsi) if ($event eq "opsi_com.pm" && $main::opsi_enabled ne "true") { - &main::daemon_log("WARNING: opsi-module is installed but not enabled in config file, please set under section '[OPSI]': 'enabled=true'", 3); + &main::daemon_log("0 WARNING: opsi-module is installed but not enabled in config file, please set under section '[OPSI]': 'enabled=true'", 3); next; } diff --git a/gosa-si/modules/ServerPackages.pm b/gosa-si/modules/ServerPackages.pm index 9d6591840..b008d01a9 100644 --- a/gosa-si/modules/ServerPackages.pm +++ b/gosa-si/modules/ServerPackages.pm @@ -23,7 +23,7 @@ END {} my ($error, $result, $event_hash) = &import_events($event_dir); foreach my $log_line (@$result) { if ($log_line =~ / succeed: /) { - &main::daemon_log("0 DEBUG: ServerPackages - $log_line", 7); + &main::daemon_log("0 INFO: ServerPackages - $log_line", 5); } else { &main::daemon_log("0 ERROR: ServerPackages - $log_line", 1); } @@ -64,10 +64,10 @@ sub process_incoming_msg { $msg =~ s/
gosa_(\w+)<\/header>|
job_(\w+)<\/header>/
$1<\/header>/; - &main::daemon_log("$session_id DEBUG: ServerPackages: msg to process '$header'", 7); + &main::daemon_log("$session_id DEBUG: ServerPackages: msg to process '$header'", 26); 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 INFO: 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); diff --git a/gosa-si/tests/client.php b/gosa-si/tests/client.php index f1a6c5138..bcf3f3010 100755 --- a/gosa-si/tests/client.php +++ b/gosa-si/tests/client.php @@ -26,10 +26,10 @@ for($count = 1; $count <= $zahl; $count++) #$data = "
gosa_delete_jobdb_entry
GOSA GOSA 3
"; # smbhash - #$data = "
gosa_gen_smb_hash
GOSAGOSAtester
"; + #$data = "
gosa_gen_smb_hash
GOSAGOSArettenbe
"; # Reload ldap config - #$data = "
gosa_trigger_reload_ldap_config
GOSA00:01:6c:9d:b9:fa
"; + #$data = "
gosa_trigger_reload_ldap_config
GOSA00:0C:29:4C:4B:0C
"; # jobdb update #$data = "
gosa_update_status_jobdb_entry
GOSA GOSA 1 19700101000000
"; @@ -55,36 +55,32 @@ for($count = 1; $count <= $zahl; $count++) #$data = "
gosa_clear_jobdb
GOSA GOSA
"; # set gosa-si-client to 'activated' - #$data = "
job_set_activated_for_installation
10.89.1.31:20083 GOSA 00:01:6c:9d:b9:fa22220101000000
"; + #$data = "
gosa_set_activated_for_installation
00:0C:29:4C:4B:0C GOSA 00:0C:29:4C:4B:0C22220101000000
"; # trigger jobs at client #$data = "
gosa_trigger_goto_settings_reload
00:01:6c:9d:b9:fa GOSA
"; - #$data = "
gosa_detect_hardware
10.89.1.31:20083 GOSA
"; - #$data = "
gosa_new_key_for_client
00:01:6c:9d:b9:fa 10.89.1.31:20081
"; - #$data = "
job_trigger_action_wake
00:01:6c:9d:b9:fa GOSA 19700101000000
"; - #$data = "
gosa_trigger_action_faireboot
00:01:6c:9d:b9:fa GOSA
"; - #$data = "
gosa_trigger_action_reboot
00:01:6c:9d:b9:fa GOSA
"; - #$data = "
gosa_trigger_action_halt
00:01:6c:9d:b9:fa GOSA
"; - #$data = "
job_trigger_action_reinstall
GOSA 00:01:6c:9d:b9:fa 00:01:6c:9d:b9:fa 19700101000000
"; -$data = "
job_trigger_action_reinstall
GOSA00:50:56:06:1c:7d00:50:56:06:1c:7d
"; - #$data = "
job_trigger_action_instant_update
00:01:6c:9d:b9:fa GOSA 19700101000000
"; + #$data = "
gosa_detect_hardware
00:0C:29:4C:4B:0C GOSA
"; + #$data = "
gosa_new_key_for_client
00:0C:29:4C:4B:0C GOSA
"; + #$data = "
gosa_trigger_action_wake
00:0C:29:4C:4B:0C GOSA
"; + #$data = "
gosa_trigger_action_faireboot
00:0C:29:4C:4B:0C GOSA
"; + #$data = "
gosa_trigger_action_reboot
00:0C:29:4C:4B:0C GOSA
"; + #$data = "
gosa_trigger_action_halt
00:0C:29:4C:4B:0C GOSA
"; + #$data = "
gosa_trigger_action_reinstall
GOSA 00:0C:29:4C:4B:0C 00:0C:29:4C:4B:0C
"; + #$data = "
gosa_trigger_action_instant_update
00:0C:29:4C:4B:0C GOSA
"; #$data = "
gosa_new_ping
00:01:6c:9d:b9:fa GOSA
"; # get_login_usr_for_client - #$data = "
gosa_get_login_usr_for_client
GOSA GOSA 00:01:6c:9d:b9:fa
"; + #$data = "
gosa_get_login_usr_for_client
GOSA GOSA 00:0C:29:4C:4B:0C
"; # get_client_for_login_usr #$data = "
gosa_get_client_for_login_usr
GOSA GOSA rettenbe
"; # List all si-server providing opsi - #$data = "
gosa_get_hosts_with_module
GOSA 10.89.1.31:20081 mailqueue_com
"; - #$data = "
gosa_get_hosts_with_module
GOSA linux-cl-2:20081 mailqueue_com
"; + $data = "
gosa_get_hosts_with_module
GOSA 00:0C:29:4C:4B:0C mailqueue_com
"; # Send messages to a user and displayed message via konch #$data = "
gosa_send_user_msg
GOSA GOSA ".base64_encode("eine wichtige nachricht")." admin polle harald 20130101235959 ".base64_encode("kaffeepause")."
"; - #$data = "
gosa_send_user_msg
10.89.1.30:20081 GOSA ".base64_encode("eine wichtige nachricht")." admin polle harald 20130101235959 ".base64_encode("kaffeepause")."
"; - #$data = "
gosa_send_user_msg
10.89.1.30:20081 GOSA ".base64_encode("eine wichtige nachricht")." admin rettenbe 20130101235959 ".base64_encode("kaffeepause")."
"; #$data = "
gosa_set_last_system
10.89.1.31:20082 GOSA 00:01:6c:9d:b9:fa 1.2.3.4 20081212000000
"; @@ -115,7 +111,7 @@ $data = "
job_trigger_action_reinstall
GOSA #$data = "
gosa_krb5_modify_principal
00:01:6c:9d:b9:fa horst@WIRECARD.SYSGOSA666
"; #$data = "
gosa_query_fai_server
GOSA 10.89.1.131:20081
"; - #$data = "
gosa_ping
00:01:6c:9d:aa:16 GOSA
"; + #$data = "
gosa_ping
00:0C:29:4C:4B:0C GOSA
"; #$data = "
gosa_ping
00:01:6c:9d:b9:fb GOSA
"; #$data = "
gosa_get_dak_keyring
GOSA GOSA
"; #$data = "
job_ping
GOSA 00:0c:29:02:e5:4d 00:0c:29:02:e5:4d29700101000000
"; @@ -210,11 +206,11 @@ $data = "
job_trigger_action_reinstall
GOSA ############################## # NTP reload - #$data = "
gosa_trigger_reload_ntp_config
GOSA GOSA 00:11:25:4B:8C:E5
"; + #$data = "
gosa_trigger_reload_ntp_config
GOSA GOSA 00:0C:29:4C:4B:0C
"; ############################## # SYSLOG reload - #$data = "
gosa_trigger_reload_syslog_config
GOSA GOSA 00:01:6c:9d:b9:fa
"; + #$data = "
gosa_trigger_reload_syslog_config
GOSA GOSA 00:0C:29:4C:4B:0C
"; -- 2.30.2