Code

Apply fix for #2852
[gosa.git] / trunk / gosa-si / server / events / clMessages.pm
index 2b4ff98d942eda75fccbb9a9795b14cd93e70c6f..7bad55ec141bc68e949f8d9c85b959c04ea53941 100644 (file)
@@ -72,6 +72,7 @@ sub save_fai_log {
     my $header = @{$msg_hash->{'header'}}[0];
     my $source = @{$msg_hash->{'source'}}[0];
     my $macaddress = @{$msg_hash->{'macaddress'}}[0];
+    my $fai_action = @{$msg_hash->{'fai_action'}}[0];
     my $all_logs = @{$msg_hash->{$header}}[0];
 
     # if there is nothing to log
@@ -92,7 +93,7 @@ sub save_fai_log {
 
     my $time = &get_time;
     $time = substr($time, 0, 8)."_".substr($time, 8, 6);
-    $client_fai_log_dir = File::Spec->catfile( $client_fai_log_dir, "install_$time" );
+    $client_fai_log_dir = File::Spec->catfile( $client_fai_log_dir, $fai_action ."_".$time );
     mkdir($client_fai_log_dir, 0755);
 
     my @all_logs = split(/log_file:/, $all_logs); 
@@ -125,7 +126,7 @@ sub LOGIN {
     my $error_str;
 
     # Invoke set_last_system; message sets ldap attributes 'gotoLastSystemLogin' and 'gotoLastSystem'
-       $res = &set_last_system($msg, $msg_hash, $session_id);
+#    &set_last_system($msg, $msg_hash, $session_id);
 
     # Add user to login_users_db
     my %add_hash = ( table=>$main::login_users_tn, 
@@ -186,7 +187,7 @@ sub CURRENTLY_LOGGED_IN {
     }
 
     # Invoke set_last_system; message sets ldap attributes 'gotoLastSystemLogin' and 'gotoLastSystem'
-       my $res = &set_last_system($msg, $msg_hash, $session_id);
+#    &set_last_system($msg, $msg_hash, $session_id);
     
     # fetch all user currently assigned to the client at login_users_db
     my %currently_logged_in_user = (); 
@@ -548,6 +549,14 @@ sub TASKBEGIN {
 
        # other TASKBEGIN msgs
     } else {
+               
+               # TASKBEGIN msgs do only occour during a softupdate or a reinstallation 
+               # of a host. Set all waiting update- or reinstall-jobs for host to 
+               # processing so they can be handled correctly by the rest of the function. 
+               my $waiting_sql = "UPDATE $main::job_queue_tn SET status='processing' WHERE status='waiting' AND macaddress LIKE '$macaddress' AND (headertag='trigger_action_update' OR headertag='trigger_action_reinstall')";  
+               &main::daemon_log("$session_id DEBUB: $waiting_sql", 7); 
+               my $waiting_res = $main::job_db->update_dbentry($waiting_sql); 
+
                # select processing jobs for host
                my $sql_statement = "SELECT * FROM $main::job_queue_tn WHERE status='processing' AND macaddress LIKE '$macaddress'"; 
                &main::daemon_log("$session_id DEBUG: $sql_statement", 7);