From 14df5bbe6176be9dd0aa797b08dbd80be098eaa1 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 7 Aug 2009 10:10:25 +0000 Subject: [PATCH] Updated fai partition stuff -Fixed handling of disk sizes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14001 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc | 1 + gosa-plugins/fai/admin/fai/class_faiPartition.inc | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc b/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc index 6d4448ee4..4d4b42968 100644 --- a/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc @@ -701,6 +701,7 @@ class faiDiskEntry extends plugin if(preg_match("/[^a-z0-9_\-]/i",$d)){ $message[] = msgPool::invalid(_("Name"),$d,"/[a-z0-9_\-]/i"); } + return ($message); } diff --git a/gosa-plugins/fai/admin/fai/class_faiPartition.inc b/gosa-plugins/fai/admin/fai/class_faiPartition.inc index fe1d5277c..059ebda2b 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartition.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartition.inc @@ -86,14 +86,14 @@ class faiPartition extends plugin * remaining * - */ // Fixed - if(preg_match("/^[0-9]*(KB|MB|GB|TB|PB|%)$/",$this->FAIpartitionSize)){ + if(preg_match("/^[0-9]{1,}(KB|MB|GB|TB|PB|%|)$/",$this->FAIpartitionSize)){ $this->sizeStart = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\1",$this->FAIpartitionSize); $this->sizeStart_Type = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\2",$this->FAIpartitionSize); $this->FAIpartitionSizeType = "fixed"; }else // Dynamic range - if(preg_match("/^[0-9]*(KB|MB|GB|TB|PB|%)-[0-9]*(KB|MB|GB|TB|PB|%)$/",$this->FAIpartitionSize)){ + if(preg_match("/^[0-9]{1,}(KB|MB|GB|TB|PB|%|)-[0-9]{1,}(KB|MB|GB|TB|PB|%|)$/",$this->FAIpartitionSize)){ $this->sizeStart = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%).*$/","\\1",$this->FAIpartitionSize); $this->sizeStart_Type = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%).*$/","\\2",$this->FAIpartitionSize); $this->sizeStop = preg_replace("/^[^\-]*\-([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\1",$this->FAIpartitionSize); @@ -102,9 +102,16 @@ class faiPartition extends plugin }else // Dynamic range - if(preg_match("/^\-$/",$this->FAIpartitionSize)){ + if(preg_match("/^(0|)\-$/",$this->FAIpartitionSize)){ $this->FAIpartitionSizeType = "remaining"; + } + // Ensure that we've a valid value type selected. + if(!preg_match("/(KB|MB|GB|TB|PB|%)/",$this->sizeStart_Type)){ + $this->sizeStart_Type = "MB"; + } + if(!preg_match("/(KB|MB|GB|TB|PB|%)/",$this->sizeStop_Type)){ + $this->sizeStop_Type = "MB"; } /* Check for encrypted partitions @@ -405,7 +412,7 @@ class faiPartition extends plugin $ret['FAIpartitionSize'] = $this->sizeStart.$this->sizeStart_Type."-". $this->sizeStop.$this->sizeStop_Type;break; case 'remaining' : - $ret['FAIpartitionSize'] = "-";break; + $ret['FAIpartitionSize'] = "0-";break; default: trigger_error("Unknown partition size!"); } -- 2.30.2