From 582b505a2d90d07c529484fd4ec3fee41985b276 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 7 Oct 2010 08:33:40 +0000 Subject: [PATCH] Updated installation method loading -use a rpc emthod to detect the available bootstrap methods git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19932 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../goto/Device/class_InstallRecipe.inc | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) 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 a4a332261..3718329c3 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc @@ -3,11 +3,11 @@ class InstallRecipe extends plugin { - public $kickstartBootstrapMethod = 'debian'; + public $kickstartBootstrapMethod = ''; public $kickstartBootstrapMethodList = NULL; - public $kickstartConfigManagement = 'puppet'; - public $kickstartConfigManagementList = array('fai' => 'FAI','puppet' => 'Puppet'); + public $kickstartConfigManagement = ''; + public $kickstartConfigManagementList = NULL; public $kickstartTemplateDN = ""; public $kickstartTemplateDNList = array( @@ -92,24 +92,31 @@ class InstallRecipe extends plugin $this->kickstartNTPServerList->setHeight("70px"); // Load list of bootstrap methods. - $this->kickstartBootstrapMethodList = $this->getBootstrapMethods(); + $this->loadInstallationMethods(); } - function getBootstrapMethods() - { - $str = file_get_contents('/home/hickert/bootstrap.json'); - $items = json_decode($str, TRUE); - if(is_array($items)){ - $ret = array(); - foreach($items as $bst){ - $ret[$bst['name']]= $bst['title']; + function loadInstallationMethods() + { + $this->kickstartBootstrapMethodList = array(); + $this->kickstartConfigManagementList = array(); + $rpc = $this->config->getRpcHandle(); + $res = $rpc->getSupportedBaseInstallMethods(); + foreach($res as $name => $method){ + $this->kickstartBootstrapMethodList[$name] = $method['name']; + foreach($method['methods'] as $m){ + $this->kickstartConfigManagementList[$name][$m] = $m; } - return($ret); } - return(NULL); + + if(empty($this->kickstartBootstrapMethod)){ + $this->kickstartBootstrapMethod = key($this->kickstartBootstrapMethodList); + } + if(empty($this->kickstartConfigManagement)){ + $this->kickstartConfigManagement = key($this->kickstartConfigManagementList[$this->kickstartBootstrapMethod]); + } } - + function execute() { @@ -137,7 +144,9 @@ class InstallRecipe extends plugin $smarty->assign('kickstartBootstrapMethod', $this->kickstartBootstrapMethod); $smarty->assign('kickstartBootstrapMethodList', $this->kickstartBootstrapMethodList); $smarty->assign('kickstartConfigManagement', $this->kickstartConfigManagement); - $smarty->assign('kickstartConfigManagementList', $this->kickstartConfigManagementList); + + $cfgList = $this->kickstartConfigManagementList[$this->kickstartBootstrapMethod]; + $smarty->assign('kickstartConfigManagementList', $cfgList); foreach($this->attributes as $attr){ $smarty->assign($attr, $this->$attr); } @@ -249,7 +258,7 @@ class InstallRecipe extends plugin return; } - $this->parent->by_name['DeviceConfig'] = $this->kickstartConfigManagementList[$mode]; + $this->parent->by_name['DeviceConfig'] = $mode ; $this->parent->by_object['DeviceConfig'] = &$this->recipeTabs[$mode]; }else{ if(isset($this->parent->by_name['DeviceConfig'])){ -- 2.30.2