Code

* Updated utf-8 handling
[gosa.git] / gosa-si / modules / GosaPackages.pm
index b3925310ee1e697d75288b2fc65171659e2e71e7..d5a0a6b4b1f4f8abdef8c2a278e15df2c1948ba0 100644 (file)
@@ -264,7 +264,7 @@ sub process_incoming_msg {
     my @msg_l;
     my @out_msg_l;
 
-    &main::daemon_log("DEBUG: GosaPackages: receive '$header'", 8);
+    &main::daemon_log("DEBUG: GosaPackages: msg to process '$header'", 7);
     
     if ($header =~ /^job_/) {
         @msg_l = &process_job_msg($msg, $msg_hash, $session_id);
@@ -315,9 +315,21 @@ sub process_gosa_msg {
         @out_msg_l = &{$event_hash->{$header}."::$header"}($msg, $msg_hash, $session_id);
     }
 
+    # if incoming 'gosa_'-msg is scheduled from job_queue, than it contains xml-tag 'jobdb_id'
+    # after procesing this msg, set status of this job in job_queue to done
+    if ($msg =~ /<jobdb_id>(\d+)<\/jobdb_id>/) {
+        my $sql_statement = "UPDATE $main::job_queue_tn ".
+            "SET status='done' ".
+            "WHERE id='$1'";
+        &main::daemon_log("DEBUG: $sql_statement", 7);         
+        my $res = $main::job_db->update_dbentry($sql_statement);
+        &main::daemon_log("INFO: set job '$1' to status processed", 5); 
+    }
+
     # if delivery not possible raise error and return 
-    if( not @out_msg_l ) {
+    if( not defined $out_msg_l[0] ) {
         &main::daemon_log("WARNING: GosaPackages got no answer from event handler '$header'", 3);
+        @out_msg_l = ();
     } elsif( $out_msg_l[0] eq 'nohandler') {
         &main::daemon_log("ERROR: GosaPackages: no event handler or core function defined for '$header'", 1);
         @out_msg_l = ();
@@ -345,6 +357,8 @@ sub process_job_msg {
     my $macaddress;
     if( exists $msg_hash->{'macaddress'} ) {
         $macaddress = @{$msg_hash->{'macaddress'}}[0];
+    } elsif (@{$msg_hash->{'target'}}[0] =~ /^([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})$/i ) {
+        $macaddress = $1;
     } else {
         $error ++;
         $out_msg = "<xml>".
@@ -352,7 +366,7 @@ sub process_job_msg {
             "<source>$server_address</source>".
             "<target>GOSA</target>".
             "<answer1>1</answer1>".
-            "<error_string>no mac address specified</error_string>".
+            "<error_string>no mac address specified, neither in target-tag nor in macaddres-tag</error_string>".
             "</xml>";
     }