Code

Added bootstrap method detection
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 18 Oct 2010 13:53:06 +0000 (13:53 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 18 Oct 2010 13:53:06 +0000 (13:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20084 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc

index 353dec517d0afca2757f879838f69afff5b3d9cb..43a93b36d33600955870bd952f7f9fa519c990c2 100644 (file)
@@ -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']);