From 4c4c5d45a70c19a831a1b778b523527d28152f2d Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 17 May 2010 13:21:32 +0000 Subject: [PATCH] Updated FAI migration -Seems to work now. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18518 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/admin/fai/class_faiManagement.inc | 2 +- .../migration/class_migrate_faiBaseRDN.inc | 53 +++++++++---------- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index c4b1a27c2..4cedda04a 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -1223,7 +1223,7 @@ class faiManagement extends management "check" => "gosaProperty::isRdn", "migrate" => "migrate_faiBaseRDN", "group" => "plugin", - "mandatory" => FALSE + "mandatory" => TRUE ), array( "name" => "defaultFaiRelease", diff --git a/gosa-plugins/fai/admin/fai/migration/class_migrate_faiBaseRDN.inc b/gosa-plugins/fai/admin/fai/migration/class_migrate_faiBaseRDN.inc index 86380dc89..3719e5865 100644 --- a/gosa-plugins/fai/admin/fai/migration/class_migrate_faiBaseRDN.inc +++ b/gosa-plugins/fai/admin/fai/migration/class_migrate_faiBaseRDN.inc @@ -3,40 +3,35 @@ class migrate_faiBaseRDN extends migrateFaiRDN implements propertyMigration { protected $filter = "(&(objectClass=nothing)%s)"; - - function checkForIssues() { - - // Check every single property which is connected to this property. - $ret = array('add' => array(), 'move' => array()); - foreach(array( - 'faiScript'=> 'faiScriptRDN', - 'faiHook'=> 'faiHookRDN', - 'faiTemplate'=> 'faiTemplateRDN', - 'faiVariable'=> 'faiVariableRDN', - 'faiProfile'=> 'faiProfileRDN', - 'faiPartitionTable'=> 'faiPartitionRDN', - 'faiPackage'=> 'faiPackageRDN') as $class => $name){ + $this->found = array(); + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); - if($this->config->configRegistry->propertyExists($class,$name)){ - $prop = $this->config->configRegistry->getProperty($class,$name); - if($prop->migrationRequired()){ - $migrator = $prop->getMigrationClass(); - if($migrator){ - $tmp = $migrator->getChanges(); - if(isset($tmp['add'])){ - $ret['add'] = array_merge($tmp['add'],$ret['add']); - } - if(isset($tmp['move'])){ - $ret['move'] = array_merge($tmp['move'],$ret['move']); - } - } - } + $initialValue = $this->prefix.$this->property->getValue().$this->suffix; + $targetValue = $this->prefix.$this->property->getValue(TRUE).$this->suffix; + $from = $initialValue.$this->config->current['BASE']; + $to = $targetValue.$this->config->current['BASE']; + + if($initialValue != $targetValue && $ldap->dn_exists($from)){ + $toParent = preg_replace("/^[^,]*+,/","",$to); + if(!$ldap->dn_exists($toParent)){ + $this->found['add'][$toParent] = array(); } + $this->found['move'][] = array('from'=>$from, 'to'=>$to); + return(TRUE); } - $this->found = $ret; - return(count($ret['add']) || count($ret['move'])); + return(FALSE); } + + function execute() + { + $str = "

"._("The storage position for FAI object has changed!")."

"; + # $str.= _("Unfortunately, GOsa can not perform the necessary steps automatically to migrate the FAI objects. You have to do this manually, to keep the System deployment in a usable state!"); + $str .= migrateFaiRDN::execute(); + return($str); + } + } ?> -- 2.30.2