From 1f40f7c1f5caf3de5641e036bab46bb08d8920e2 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 10 Aug 2009 08:20:32 +0000 Subject: [PATCH] Updated FAI partition handling. -Added some cleanup after successful save/aplly git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14019 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/admin/fai/class_faiPartitionTable.inc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc index b5b8937d2..213e9db8c 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc @@ -527,6 +527,7 @@ class faiPartitionTable extends plugin /* Append all disks to ldap */ foreach($order as $cn=>$disk){ + $disk_dn = "cn=".$disk['cn'].",".$this->dn; $disk_attrs['cn'] = $disk['cn']; $disk_attrs['objectClass'] = array("top","FAIclass","FAIpartitionDisk"); @@ -565,6 +566,7 @@ class faiPartitionTable extends plugin if($disk['status'] == "delete"){ FAI::prepare_to_save_FAI_object($disk_dn,array(),true); $this->handle_post_events("remove"); + unset($this->disks[$cn]); }elseif($disk['status'] == "edited"){ FAI::prepare_to_save_FAI_object($disk_dn,$disk_attrs); $this->handle_post_events("modify"); @@ -576,7 +578,7 @@ class faiPartitionTable extends plugin if($disk['status']!="delete") /* Add all partitions */ - foreach($disk['partitions'] as $key => $partition){ + foreach($disk['partitions'] as $pkey => $partition){ $partition_attrs = array(); foreach($partition as $key => $value){ @@ -610,6 +612,7 @@ class faiPartitionTable extends plugin if($partition['status'] == "delete"){ FAI::prepare_to_save_FAI_object($partition_dn,array(),true); $this->handle_post_events("remove"); + unset($this->disks[$cn]['partitions'][$pkey]); }elseif($partition['status'] == "edited"){ FAI::prepare_to_save_FAI_object($partition_dn,$partition_attrs); $this->handle_post_events("modify"); @@ -617,8 +620,19 @@ class faiPartitionTable extends plugin FAI::prepare_to_save_FAI_object($partition_dn,$partition_attrs); $this->handle_post_events("add"); } + + // We do not need the status flag any longer + if(isset($this->disks[$cn]['partitions'][$pkey]['status'])){ + unset($this->disks[$cn]['partitions'][$pkey]['status']); + } + } + // We do not need the status flag any longer + if(isset($this->disks[$cn]['status'])){ + unset($this->disks[$cn]['status']); } } + $this->initial_disks = $this->disks; + print_a($this->disks); $this->handle_post_events("add"); } -- 2.30.2