Code

Updated FAIpartition handling.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 7 Aug 2009 14:48:45 +0000 (14:48 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 7 Aug 2009 14:48:45 +0000 (14:48 +0000)
-We are now able to remove partitions again.

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

gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc
gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc

index 77a6adc0a2116af85414a1edde3dab8ece1473d8..9d38144207164877530b58a350150487a49293b3 100644 (file)
@@ -56,7 +56,9 @@ class faiDiskEntry extends plugin
       $this->old_cn          = $disk['cn'];
 
       // Load partition info 
-      foreach($disk['partitions'] as $name => $values){
+      foreach($disk['partitions'] as $values){
+
+        $name = $values['FAIpartitionNr'];
 
         // Do not load removed partitions 
         if($values['status'] == "delete"){
@@ -629,6 +631,7 @@ class faiDiskEntry extends plugin
      * And prepare names and numbers.
      */
     foreach($this->partitions as $key=>$val) {
+      if($val['status'] == "delete") continue; 
       $this->partitions[$key]['FAIpartitionNr']=$key;
       if($this->FAIdiskType == "disk"){
         $this->partitions[$key]['cn'] = $this->DISKcn.$key;
@@ -637,13 +640,6 @@ class faiDiskEntry extends plugin
       }
     }
 
-    /* Attach deleted.
-     */
-    foreach($this->deletePartitions as $key=>$val) {
-      $this->partitions[$key."-delete"]=$val;
-      $this->partitions[$key."-delete"]['status']="delete";
-    }
-
     $tmp['description'] = $this->DISKdescription;
     $tmp['partitions']  = $this->partitions;
     $tmp['status']      = $this->status;
@@ -711,6 +707,14 @@ class faiDiskEntry extends plugin
       $tmp['FAIdiskOption'][] = "preserve_reinstall:".trim($preserve_reinstall,",");
     }
 
+    /* Attach deleted.
+     */
+    foreach($this->deletePartitions as $val) {
+      $key = $val['FAIpartitionNr'];
+      $this->partitions[$key."-delete"]=$val;
+      $this->partitions[$key."-delete"]['status']="delete";
+    }
+
     $tmp['status'] = $this->status;
     return($tmp);
   }
index 93f486090c4d9c45aa4babf012f9ae50d036dbd5..8bcebec847a14fb465174dbd293e7b470a9c9232 100644 (file)
@@ -679,7 +679,7 @@ class faiPartitionTable extends plugin
           /* Important, mark all edited devices for removal.
            * If the partition number changes we do not have the object twice.
            */
-          if($part['status'] == "edited"){
+          if($part['status'] != "new"){
             $part['status'] = "delete";
             $newSetup[$partid] = $part; 
           }