From 84d4e015cf5f0cb2ba9f4017e890ad57356c01ad Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 29 Nov 2007 14:14:13 +0000 Subject: [PATCH] Fixed workstation starttab. - We had to reload the FAIstarttab for newly created worktstations/servers to see all classes of "auto/some_release". - Fixed class detection for selected release. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7943 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/class_workstationStartup.inc | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc index d74d760ee..8e9ed5240 100644 --- a/plugins/admin/systems/class_workstationStartup.inc +++ b/plugins/admin/systems/class_workstationStartup.inc @@ -213,13 +213,14 @@ class workstartup extends plugin /* Result will be cached */ - $test[$url]['RELEASE'][$release]['PACKAGES'] = $this->getAvailableClassesForThisRelease($release); + $rel_classes = $this->getAvailableClassesForThisRelease($release); + $test[$url]['RELEASE'][$release]['PACKAGES'] = $rel_classes; $test[$url]['SERVER'] = $server; /* auto gets all releases/classes */ $test['auto']['RELEASE'][$release]['SECTION'] = $sections; - $test['auto']['RELEASE'][$release]['PACKAGES'] = $this->getAvailableClassesForThisRelease($release); + $test['auto']['RELEASE'][$release]['PACKAGES'] = $rel_classes; } } } @@ -405,6 +406,13 @@ class workstartup extends plugin if (!isset($this->gotoBootKernels['default-inherited']) && $this->gotoBootKernel == "default-inherited"){ $this->gotoBootKernel= "default"; } + + /* Preselect release if none was selected yet */ + if(empty($this->FAIrelease) && $this->FAIdebianMirror == "auto"){ + if(isset($this->FAIServRepConfig['auto']['RELEASE']) && is_array($this->FAIServRepConfig['auto']['RELEASE'])){ + $this->FAIrelease = key($this->FAIServRepConfig['auto']['RELEASE']); + } + } } @@ -417,14 +425,13 @@ class workstartup extends plugin { /* There could be more than one server providing this release, so use cached result if available - */ + */ if(isset($_SESSION['getAvailableClassesForThisRelease_CACHE'][$release])) { return($_SESSION['getAvailableClassesForThisRelease_CACHE'][$release]); } $test2 = array(); -# $bb = $this->generateDNSyn($release).$_SESSION['CurrentMainBase']; - $bb = $this->generateDNSyn($release).$this->config->current['BASE']; + $bb = $this->generateDNSyn($release); $ldap = $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); @@ -918,15 +925,22 @@ class workstartup extends plugin $str = ""; $tmp = split("\/",$release); $tmp = array_reverse($tmp); - $base = "ou=fai,ou=configs,ou=systems,"; foreach($tmp as $departmentname){ - $str .= ",ou=".$departmentname; } $str = preg_replace("/^,/","",($str.",".$base)); - - return($str); + + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=FAIbranch))",array("ou")); + while($attrs = $ldap->fetch()){ + if(preg_match("/".normalizePreg($str)."/",$attrs['dn'])){ + return($attrs['dn']); + } + } + + return($str.$this->config->current['BASE']); } function getFAIdebianMirrors() -- 2.30.2