Code

Apply patch from mba for #4170
authorpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 21 May 2010 12:23:56 +0000 (12:23 +0000)
committerpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 21 May 2010 12:23:56 +0000 (12:23 +0000)
For the removal of debconf configuration use the
prepare_to_save_FAI_object (which respects CoW) and
fix some bugs that would have prevented its usage.

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@18612 594d385d-05f5-0310-b6e9-bd551577e9d8

trunk/gosa-plugins/fai/admin/fai/class_FAI.inc
trunk/gosa-plugins/fai/admin/fai/class_faiManagement.inc
trunk/gosa-plugins/fai/admin/fai/class_faiPackage.inc

index c3005f198be79b6f83cc2ce2fffda6aecd5f79eb..2b3d1a0b5eba2e9e63665109e042aff055990ded 100644 (file)
@@ -613,7 +613,7 @@ class FAI
 
         /* Ldap search for fai classes specified in this release */
         $ldap->cd($fai_base);
-        $ldap->search("(objectClass=FAIclass)",array("dn","objectClass","FAIstate"));
+        $ldap->search("(|(objectClass=FAIclass)(objectClass=FAIdebconfInfo))",array("dn","objectClass","FAIstate"));
 
         /* check the returned objects, and add/replace them in our return variable */
         while($attr = $ldap->fetch()){
index 7f40c58b622ca2f8f96ce3bf2cb7aa12f3b9a4ff..c0114568aab192844a91429f03e9d619435b6b80 100644 (file)
@@ -981,8 +981,8 @@ class faiManagement extends plugin
         $ldap->cd($this->dn);
         foreach($to_del as $dn){
           /* Only delete subobjects of the current FAI class */
-          $cn = $ldap->getCn($dn);
-          $ldap->search("cn=$cn", array('dn'));
+          $ldap->cd($this->dn);
+          $ldap->search("(|(objectClass=FAIclass)(objectClass=FAIdebconfInfo))", array('dn'));
           if ($ldap->count()){
             while($attrs = $ldap->fetch()){
               if ($attrs['dn'] == $dn) {
index fb7ad0902621e56bc79161da4b2d2e330ecb04ff..9bf75f59808807ce078fd9f5a2eefc507a51a572 100644 (file)
@@ -696,8 +696,7 @@ class faiPackage extends plugin
         $ldap = $this->config->get_ldap_link();
         $ldap->cat($dn);
         if ($ldap->count()) {
-          $ldap->cd($dn);
-          $ldap->rmdir($dn);
+          FAI::prepare_to_save_FAI_object($dn,array(),true);
         }
       }
     }
@@ -723,8 +722,7 @@ class faiPackage extends plugin
           $ldap = $this->config->get_ldap_link();
           $ldap->cat($pkgdn);
           if ($ldap->count()) {
-            $ldap->cd($pkgdn);
-            $ldap->rmdir($pkgdn);
+            FAI::prepare_to_save_FAI_object($pkgdn,array(),true);
           }
           else {
             unset($this->ConfiguredPackages[$pkgname][$name]);