From 3e1aa6f3997238eb4d6b5534bc8dcbae52d15383 Mon Sep 17 00:00:00 2001 From: rettenbe Date: Wed, 5 Nov 2008 10:12:19 +0000 Subject: [PATCH] update test, job importing bug git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12921 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/server/events/gosaTriggered.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index aaec74eff..0639c0213 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -805,6 +805,12 @@ sub trigger_activate_new { my $dhcp_statement= (defined($msg_hash->{'dhcp'}))?@{$msg_hash->{'dhcp'}}[0]:undef; my $jobdb_id= (defined($msg_hash->{'jobdb_id'}))?@{$msg_hash->{'jobdb_id'}}[0]:undef; + # Sanity check for base + if (ref($base) eq "HASH") { + # Incoming msg has a xml tag 'base' but no content + $base = undef; + } + # In case that the client is sleeping, wake it up my %data = ( 'macaddress' => $mac ); my $wake_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data); @@ -818,8 +824,6 @@ sub trigger_activate_new { my $error = &main::send_msg_to_target($wake_msg, $host_name, $host_key, $header, $session_id); } - - my $ldap_handle = &main::get_ldap_handle(); my $ldap_entry; my $ogroup_entry; @@ -882,10 +886,10 @@ 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("$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 = '".(&calc_timestamp(&get_time(), 'plus', 10))."' WHERE id = $jobdb_id"); - return undef; + my $error_string = "Moving the system with mac address '$mac' to new base '$base' failed (code '".$moddn_result->code()."') with '".$moddn_result->{'errorMessage'}."'!"; + &main::daemon_log("$session_id ERROR: $error_string", 1); + my $sql = "UPDATE $main::job_queue_tn SET status='error', result='$error_string' WHERE id=$jobdb_id"; + return undef; } else { &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"); -- 2.30.2