From 01e68e59d0441415735d4a3bb302442b5c68de60 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 1 Jun 2006 04:38:04 +0000 Subject: [PATCH] Added FAIdebianRelease rewriting to branch / freeze function. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3591 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_ldap.inc | 9 +++++++-- plugins/admin/fai/class_faiManagement.inc | 17 +++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/include/class_ldap.inc b/include/class_ldap.inc index 2ed4ceea0..b6a11be99 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -439,7 +439,7 @@ class LDAP{ /* Copy given attributes and sub-dns with attributes to destination dn */ - function copy_FAI_resource_recursive($sourcedn,$destinationdn,$type="branch",$is_first = true,$depth=0) + function copy_FAI_resource_recursive($sourcedn,$destinationdn,$destinationName,$type="branch",$is_first = true,$depth=0) { error_reporting(E_ALL); @@ -554,6 +554,11 @@ class LDAP{ } } + /* Replace FAIdebianRelease with new release name */ + if(in_array("FAIpackageList" , $attr['objectClass'])){ + $attr['FAIdebianRelease'] = $destinationName; + } + /* Add entry */ $this->cd($destinationdn); $this->cat($destinationdn); @@ -588,7 +593,7 @@ class LDAP{ $this->cd($basedn); $item = $this->fetch($this->cat($dn)); if(!in_array("FAIbranch",$item['objectClass'])){ - $this->copy_FAI_resource_recursive($dn,str_replace($sourcedn,$destinationdn,$dn),$type,false,$depth); + $this->copy_FAI_resource_recursive($dn,str_replace($sourcedn,$destinationdn,$dn),$destinationName,$type,false,$depth); } } } diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc index b134623f0..0fac333fa 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -353,6 +353,19 @@ class faiManagement extends plugin if($this->DivListFai->selectedBranch != "main" ){ $baseToUse = $this->DivListFai->selectedBranch; } + + /* Create new Release name to be able to set faidebianRelease for FAIpackageList */ + + $CurrentReleases = $this->getBranches(); + $NewReleaseName = $name; + if(isset($CurrentReleases[$this->DivListFai->selectedBranch])) { + if($this->DivListFai->selectedBranch != "main"){ + $NewReleaseName = $CurrentReleases[$this->DivListFai->selectedBranch]."/".$name; + $NewReleaseName = preg_replace("#\/#","/",$NewReleaseName); + }else{ + $NewReleaseName = $name; + } + } $appsrc = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,",$baseToUse); $appdst = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,","ou=".$name.",".$baseToUse) ; @@ -366,14 +379,14 @@ class faiManagement extends plugin $ldap->cd ($appdst); $ldap->recursive_remove(); $ldap->cd ($this->config->current['BASE']); - $ldap->copy_FAI_resource_recursive($appsrc,$appdst,$type,true); + $ldap->copy_FAI_resource_recursive($appsrc,$appdst,$NewReleaseName,$type,true); /* Duplicate fai objects */ $ldap->cd ("ou=".$name.",".$baseToUse); $ldap->recursive_remove(); $ldap->cd ($this->config->current['BASE']); - $ldap->copy_FAI_resource_recursive($baseToUse,"ou=".$name.",".$baseToUse,$type,true); + $ldap->copy_FAI_resource_recursive($baseToUse,"ou=".$name.",".$baseToUse,$NewReleaseName,$type,true); echo "

-- 2.30.2