From: hickert Date: Mon, 18 Oct 2010 13:53:06 +0000 (+0000) Subject: Added bootstrap method detection X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b2588f164f354ab166d9e685528662905d0557a2;p=gosa.git Added bootstrap method detection git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20084 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc index 353dec517..43a93b36d 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc @@ -46,6 +46,7 @@ class InstallRecipe extends plugin "installRootEnabled","installRootPasswordHash","installKernelPackage", "installPartitionTable","installConfigManagement","installBootstrapMethod"); + private $map = array('puppet' => array('objectClass' => 'puppetClient', 'type' => 'puppet', 'bootstrap' => 'preseed')); /* Some plugin management related attributes * See class plugin for details. @@ -81,9 +82,20 @@ class InstallRecipe extends plugin */ function init() { + // Detect account status by checking the used objectClasses + $this->is_account = FALSE; + foreach($this->map as $type){ + if(in_array($type['objectClass'], $this->attrs['objectClass'])){ + $this->installBootstrapMethod = $type['bootstrap']; + $this->installConfigManagement = $type['type']; + $this->is_account = TRUE; + } + } + // Start without error. $this->initFailed = FALSE; + // Prepare list of timezones $this->timezones = $this->getTimezones(); @@ -273,8 +285,6 @@ class InstallRecipe extends plugin function save_object() { - - if(isset($_POST['InstallRecipePosted'])){ $currentInstallMethod = $this->installConfigManagement; @@ -328,6 +338,15 @@ class InstallRecipe extends plugin unset($this->attrs['installBootstrapMethod']); echo "Skipp saving of 'installConfigManagement' and 'installBootstrapMethod', i've no idea where to store them."; + // Remove all objectClasses which belongs to a bootstrap method, + // and then add the selected one. + foreach($this->map as $type){ + $this->attrs['objectClass'] = array_remove_entries_ics(array($type['objectClass']), $this->attrs['objectClass']); + } + $this->attrs['objectClass'][] = $this->map[$this->installConfigManagement]['objectClass']; + + print_a($this->attrs); + $this->cleanup(); $ldap=$this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']);