summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1a2a0bb)
raw | patch | inline | side by side (parent: 1a2a0bb)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 3 Jul 2009 09:05:45 +0000 (09:05 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 3 Jul 2009 09:05:45 +0000 (09:05 +0000) |
object gets modified and check that the parent object is not marked as
removed in is_child_of_cow_parent()
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13879 594d385d-05f5-0310-b6e9-bd551577e9d8
removed in is_child_of_cow_parent()
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13879 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-plugins/fai/admin/fai/class_FAI.inc | patch | blob | history |
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc b/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc
index 605acb8dfd5550b92697fb84525aef99e6ee5d60..0278c5a1747f8d687f88a43308a71326bdbb4992 100644 (file)
}
foreach($r as $key ){
- if(DEBUG_FAI_FUNC) {
- echo "<b>Create an empty placeholder in follwing release</b> ".$key;
- print_a($objectAttrs);
- }
- /* Only save removed parent objects, not their children */
- if (FAI::is_parent_object($Current_DN)){
+ /* Only save removed parent objects, not their children, unless
+ they are a child of a copy-on-write parent in a subrelease */
+ if (FAI::is_parent_object($Current_DN) || FAI::is_child_of_cow_parent($key)){
+ if(DEBUG_FAI_FUNC) {
+ echo "<b>Create an empty placeholder in follwing release</b> ".$key;
+ print_a($objectAttrs);
+ }
FAI::save_FAI_object($key,$objectAttrs);
}
}
*/
$rTag = FAI::get_release_tag(FAI::get_release_dn($key));
$parent_attrs['FAIstate'] = $rTag;
- FAI::save_FAI_object($key,$parent_attrs);
}
+ FAI::save_FAI_object($key,$parent_attrs);
}
}
return $children;
}
- /* Get the DN of the parent object; e.g. the FAIpartitionTable of a FAIpartitionDisk */
- static function get_parent_object($dn)
+ /* Get the DN of the parent object; e.g. the FAIpartitionTable of a FAIpartitionDisk.
+ If $check is false, do not check whether the parent actually exists in LDAP */
+ static function get_parent_object($dn, $check=true)
{
global $config;
$Current_DN = $dn;
$parent_dn = join($parent_dn, ',');
if ($parent_dn != $Current_DN){
- $ldap = $config->get_ldap_link();
- $ldap->cd($config->current['BASE']);
- $ldap->cat($parent_dn);
- if($ldap->count()){
- return $parent_dn;
+ if($check){
+ $ldap = $config->get_ldap_link();
+ $ldap->cd($config->current['BASE']);
+ $ldap->cat($parent_dn);
+ if(!$ldap->count()){
+ return "";
+ }
}
+ return $parent_dn;
}
return "";
}
}
return false;
}
+
+ /* Check whether this is a child object of a Copy-on-Write parent */
+ static function is_child_of_cow_parent($dn)
+ {
+ global $config;
+ $Current_DN = $dn;
+ $parent_dn = "";
+
+ if (!FAI::is_parent_object($Current_DN)){
+
+ /* This is a child object; check that the parent object is not
+ marked as removed */
+ $cow_parent_dn = FAI::get_parent_object($Current_DN, false);
+ if ($cow_parent_dn && !FAI::parent_is_removed($Current_DN)){
+
+ /* This is a child object, check whether the parent object in
+ the main release exists */
+ $main_parent_dn = FAI::get_parent_release_object($cow_parent_dn);
+ $ldap = $config->get_ldap_link();
+ $ldap->cd($config->current['BASE']);
+ $ldap->cat($main_parent_dn);
+ if($ldap->count()){
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
}