Code

Updated goto
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 Mar 2008 09:09:12 +0000 (09:09 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 Mar 2008 09:09:12 +0000 (09:09 +0000)
-Send localboot when reinstall wasn't started yet

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

gosa-plugins/goto/addons/goto/class_gotomasses.inc
gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc

index c743130e03bdc31f4539e665cf88d3cecd92c581..e168b880eecb143abb367b61be94bee7848a07a8 100644 (file)
@@ -220,6 +220,27 @@ class gotomasses extends plugin
 
     /* Remove specified tasks */
     if(count($this->ids_to_remove) && isset($_POST['delete_multiple_confirm'])){
+
+      /* Reboot hosts with not yet startet installations and timestamps in the past 
+       */
+      timezone::get_default_timezone();
+      foreach($this->ids_to_remove as $id){
+        $entry = $this->o_queue->get_entries_by_id(array($id));
+        if(isset($entry['ANSWER1'])){
+          $entry = $entry['ANSWER1'];
+          if( $entry['STATUS'] == "wating" && 
+              $entry['HEADERTAG'] == "trigger_action_reinstall"){
+            $evt = new DaemonEvent_reinstall($this->config,$entry);
+            if($evt->get_timestamp(FALSE)  < time()){
+              $r_evt = new DaemonEvent_localboot($this->config);
+              $r_evt->add_targets(array($entry['MACADDRESS']));
+              $r_evt->set_type(TRIGGERED_EVENT);
+              $this->o_queue->append($r_evt);
+            }
+          }
+        }
+      }
+
       $this->o_queue->remove_entries($this->ids_to_remove);
       $this->save();
     }
index c852cfafb88d29c7636c74dd65712410e725bf3d..bf231e7714c5b7bcbfd38dea881671b91c659c7c 100644 (file)
@@ -455,9 +455,13 @@ class DaemonEvent
   /*! \brief  Returns the event timestamp in GOsa daemon format. 
     @return Returns the event timestamp (20081231120000)
    */
-  public function get_timestamp()
+  public function get_timestamp($si_type = TRUE)
   {
-    return($this->_timestamp_to_event($this->timestamp));
+    if($si_type){
+      return($this->_timestamp_to_event($this->timestamp));
+    }else{
+      return($this->timestamp);
+    }
   }