From ad8dd6fc40fba2e6618b1b3a2f828dea66377f18 Mon Sep 17 00:00:00 2001 From: janw Date: Thu, 11 Sep 2008 09:59:25 +0000 Subject: [PATCH] Added session_id to log messages. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12417 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/server/events/gosaTriggered.pm | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index 6aeae783e..3ffdf5719 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -814,12 +814,12 @@ sub trigger_activate_new { if($ldap_mesg->count == 1) { $ogroup_entry= $ldap_mesg->pop_entry(); } elsif ($ldap_mesg->count == 0) { - &main::daemon_log("ERROR: A GosaGroupOfNames with cn '$ogroup' was not found in base '".$main::ldap_base."'!", 1); + &main::daemon_log("$session_id ERROR: A GosaGroupOfNames with cn '$ogroup' was not found in base '".$main::ldap_base."'!", 1); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting' WHERE id = $jobdb_id"); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET timestamp = '".&get_time(10)."' WHERE id = $jobdb_id"); return undef; } else { - &main::daemon_log("ERROR: More than one ObjectGroups with cn '$ogroup' was found in base '".$main::ldap_base."'!", 1); + &main::daemon_log("$session_id ERROR: More than one ObjectGroups with cn '$ogroup' was found in base '".$main::ldap_base."'!", 1); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting' WHERE id = $jobdb_id"); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET timestamp = '".&get_time(10)."' WHERE id = $jobdb_id"); return undef; @@ -829,7 +829,7 @@ sub trigger_activate_new { if(!(defined($base) && (length($base) > 0))) { # Subtract the ObjectGroup cn $base = $1 if $ogroup_entry->dn =~ /cn=$ogroup,ou=groups,(.*)$/; - &main::daemon_log("DEBUG: New base for system with mac address '$mac' is '$base'", 5); + &main::daemon_log("$session_id DEBUG: New base for system with mac address '$mac' is '$base'", 5); } } @@ -845,7 +845,7 @@ sub trigger_activate_new { # TODO: Find a way to guess an ip address for hosts with no ldap entry (MAC->ARP->IP) if($ldap_mesg->count == 1) { - &main::daemon_log("DEBUG: One system with mac address '$mac' was found in base '".$main::ldap_base."'!", 5); + &main::daemon_log("$session_id DEBUG: One system with mac address '$mac' was found in base '".$main::ldap_base."'!", 5); # Get the entry from LDAP $ldap_entry= $ldap_mesg->pop_entry(); @@ -860,12 +860,12 @@ sub trigger_activate_new { # To prevent replication problems just re-queue the job with 10 seconds in the future my $moddn_result = $ldap_entry->update($ldap_handle); if ($moddn_result->code() != 0) { - &main::daemon_log("ERROR: Moving the system with mac address '$mac' to new base '$base' failed (code '".$moddn_result->code()."') with '".$moddn_result->{'errorMessage'}."'!", 1); + &main::daemon_log("$session_id ERROR: Moving the system with mac address '$mac' to new base '$base' failed (code '".$moddn_result->code()."') with '".$moddn_result->{'errorMessage'}."'!", 1); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting' WHERE id = $jobdb_id"); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET timestamp = '".&get_time(10)."' WHERE id = $jobdb_id"); return undef; } else { - &main::daemon_log("INFO: System with mac address '$mac' was moved to base '".$main::ldap_base."'! Re-queuing job.", 4); + &main::daemon_log("$session_id INFO: System with mac address '$mac' was moved to base '".$main::ldap_base."'! Re-queuing job.", 4); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting' WHERE id = $jobdb_id"); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET timestamp = '".&get_time(10)."' WHERE id = $jobdb_id"); return undef; @@ -873,7 +873,7 @@ sub trigger_activate_new { } } elsif ($ldap_mesg->count == 0) { - &main::daemon_log("WARNING: No System with mac address '$mac' was found in base '".$main::ldap_base."'! Re-queuing job.", 4); + &main::daemon_log("$session_id WARNING: No System with mac address '$mac' was found in base '".$main::ldap_base."'! Re-queuing job.", 4); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting' WHERE id = $jobdb_id"); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET timestamp = '".&get_time(60)."' WHERE id = $jobdb_id"); return undef; @@ -892,13 +892,13 @@ sub trigger_activate_new { my $oclasses = $ldap_entry->get_value('objectClass', asref => 1); foreach my $oclass ("FAIobject", "GOhard", "gotoWorkstation") { if(!(scalar grep $_ eq $oclass, map {$_ => 1} @$oclasses)) { - &main::daemon_log("Adding objectClass $oclass", 1); + &main::daemon_log("$session_id INFO: Adding objectClass '$oclass' to system entry with mac adress '$mac'", 1); $ldap_entry->add( objectClass => $oclass, ); my $oclass_result = $ldap_entry->update($ldap_handle); if ($oclass_result->code() != 0) { - &main::daemon_log("ERROR: Adding the ObjectClass '$oclass' failed (code '".$oclass_result->code()."') with '".$oclass_result->{'errorMessage'}."'!", 1); + &main::daemon_log("$session_id ERROR: Adding the ObjectClass '$oclass' failed (code '".$oclass_result->code()."') with '".$oclass_result->{'errorMessage'}."'!", 1); } } } @@ -911,7 +911,7 @@ sub trigger_activate_new { ); my $replace_result = $ldap_entry->update($ldap_handle); if ($replace_result->code() != 0) { - &main::daemon_log("ERROR: Setting the FAIstate to install failed with code '".$replace_result->code()."') and message '".$replace_result->{'errorMessage'}."'!", 1); + &main::daemon_log("$session_id ERROR: Setting the FAIstate to install failed with code '".$replace_result->code()."') and message '".$replace_result->{'errorMessage'}."'!", 1); } } } else { @@ -920,7 +920,7 @@ sub trigger_activate_new { ); my $add_result = $ldap_entry->update($ldap_handle); if ($add_result->code() != 0) { - &main::daemon_log("ERROR: Setting the FAIstate to install failed with code '".$add_result->code()."') and message '".$add_result->{'errorMessage'}."'!", 1); + &main::daemon_log("$session_id ERROR: Setting the FAIstate to install failed with code '".$add_result->code()."') and message '".$add_result->{'errorMessage'}."'!", 1); } } @@ -929,12 +929,12 @@ sub trigger_activate_new { # TODO: Create a new entry # $ldap_entry = Net::LDAP::Entry->new(); # $ldap_entry->dn("cn=$mac,$base"); - &main::daemon_log("WARNING: No System with mac address '$mac' was found in base '".$main::ldap_base."'! Re-queuing job.", 4); + &main::daemon_log("$session_id WARNING: No System with mac address '$mac' was found in base '".$main::ldap_base."'! Re-queuing job.", 4); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting' WHERE id = $jobdb_id"); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET timestamp = '".&get_time(10)."' WHERE id = $jobdb_id"); return undef; } else { - &main::daemon_log("ERROR: More than one system with mac address '$mac' was found in base '".$main::ldap_base."'!", 1); + &main::daemon_log("$session_id ERROR: More than one system with mac address '$mac' was found in base '".$main::ldap_base."'!", 1); } # Add to ObjectGroup @@ -944,10 +944,10 @@ sub trigger_activate_new { ); my $ogroup_result = $ogroup_entry->update($ldap_handle); if ($ogroup_result->code() != 0) { - &main::daemon_log("ERROR: Updating the ObjectGroup '$ogroup' failed (code '".$ogroup_result->code()."') with '".$ogroup_result->{'errorMessage'}."'!", 1); + &main::daemon_log("$session_id ERROR: Updating the ObjectGroup '$ogroup' failed (code '".$ogroup_result->code()."') with '".$ogroup_result->{'errorMessage'}."'!", 1); } } else { - &main::daemon_log("DEBUG: System with mac address '$mac' is already a member of ObjectGroup '$ogroup'.", 5); + &main::daemon_log("$session_id DEBUG: System with mac address '$mac' is already a member of ObjectGroup '$ogroup'.", 5); } # Finally set gotoMode to active @@ -958,7 +958,7 @@ sub trigger_activate_new { ); my $activate_result = $ldap_entry->update($ldap_handle); if ($activate_result->code() != 0) { - &main::daemon_log("ERROR: Activating system '".$ldap_entry->dn()."' failed (code '".$activate_result->code()."') with '".$activate_result->{'errorMessage'}."'!", 1); + &main::daemon_log("$session_id ERROR: Activating system '".$ldap_entry->dn()."' failed (code '".$activate_result->code()."') with '".$activate_result->{'errorMessage'}."'!", 1); } else { $activate_client = 1; } @@ -971,7 +971,7 @@ sub trigger_activate_new { ); my $activate_result = $ldap_entry->update($ldap_handle); if ($activate_result->code() != 0) { - &main::daemon_log("ERROR: Activating system '".$ldap_entry->dn()."' failed (code '".$activate_result->code()."') with '".$activate_result->{'errorMessage'}."'!", 1); + &main::daemon_log("$session_id ERROR: Activating system '".$ldap_entry->dn()."' failed (code '".$activate_result->code()."') with '".$activate_result->{'errorMessage'}."'!", 1); } else { $activate_client = 1; } @@ -988,7 +988,7 @@ sub trigger_activate_new { return @out_msg_l; } else { - &main::daemon_log("WARNING: Activating system with mac address '$mac' failed! Re-queuing job.", 4); + &main::daemon_log("$session_id WARNING: Activating system with mac address '$mac' failed! Re-queuing job.", 4); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting' WHERE id = $jobdb_id"); $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET timestamp = '".&get_time(10)."' WHERE id = $jobdb_id"); } -- 2.30.2