Code

Updated system Management.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 Mar 2008 10:33:35 +0000 (10:33 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 Mar 2008 10:33:35 +0000 (10:33 +0000)
-Only add triggeredd events, if not already in process

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9894 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/systems/admin/systems/class_systemManagement.inc

index f56c0b574001d2e5259f207f0990d78599f92e5b..6283f5c1b9976e9a7617cf58609e542304fa1ad1 100644 (file)
@@ -519,6 +519,27 @@ class systems extends plugin
         }
         $events = DaemonEvent::get_event_types(SYSTEM_EVENT);
         $type = preg_replace("/^[a-z]*_event_/","",$s_action);
+        $o_queue = new gosaSupportDaemon();
+
+        /* Skip installation or update trigerred events, 
+         *  if this entry is currently processing.
+         */
+        if(preg_match("/trigger_event/",$s_action) && in_array($type,array("DaemonEvent_reinstall","DaemonEvent_update"))){
+          foreach($mac as $key => $mac_address){
+            foreach($o_queue->get_entries_by_mac(array($mac_address)) as $entry){
+
+              $entry['STATUS'] = strtoupper($entry['STATUS']);
+              if($entry['STATUS'] == "PROCESSING" && 
+                  isset($events['QUEUED'][$entry['HEADERTAG']]) && 
+                  in_array($events['QUEUED'][$entry['HEADERTAG']],array("DaemonEvent_reinstall","DaemonEvent_update"))){
+                unset($mac[$key]);
+
+                new log("security","systems/".get_class($this),"",array(),"Skip adding 'DaemonEvent::".$type."' for mac '".$mac_address."', there is already a job in progress.");
+                break;
+              }
+            }
+          }
+        }        
 
         /* Prepare event to be added 
          */