From 265040e51fe0ab49ef89378f14f4763ab2072e16 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 26 Aug 2008 13:19:00 +0000 Subject: [PATCH] Updated of opsi stuff -Some changes to implement actions, later. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12276 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-plugins/opsi/admin/opsi/class_opsi.inc | 35 ++++++++++++++++--- .../opsi/admin/opsi/class_opsigeneric.inc | 19 ++++++++++ 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/gosa-plugins/opsi/admin/opsi/class_opsi.inc b/gosa-plugins/opsi/admin/opsi/class_opsi.inc index 290f39157..ec2c51a05 100644 --- a/gosa-plugins/opsi/admin/opsi/class_opsi.inc +++ b/gosa-plugins/opsi/admin/opsi/class_opsi.inc @@ -90,6 +90,18 @@ class opsi extends gosaSupportDaemon } + /*! \brief Trigger an event like wake or install for a specific hostId. + */ + public function send_action($type,$hostId) + { + switch($type){ + case 'install' : $this->job_opsi_install_client($hostId); break; + case 'wake' : $this->job_opsi_wake_client($hostId); break; + default : trigger_error('Unknown type '.$type.'.'); + } + } + + /****************** SI Communication functions ******************/ @@ -415,11 +427,26 @@ class opsi extends gosaSupportDaemon } /* Query SI server */ - $res = $this->send_data("job_opsi_install_client",$this->target,$data,TRUE); - if(isset($res['XML'][0]['ITEM'])){ - return($res['XML'][0]['ITEM']); + $this->send_data("job_opsi_install_client",$this->target,$data,TRUE); + } + + + /*! \brief Triggers install/reinstall of an opsi client. + @param + @return + */ + public function job_opsi_wake_client($hostId) + { + $data = array("hostId" => $hostId); + + /* Check parameter */ + if(empty($hostId)){ + trigger_error("No valid host id given, check parameter 1."); + return; } - return(array()); + + /* Query SI server */ + $this->send_data("job_opsi_wake_client",$this->target,$data,TRUE); } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc b/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc index 98d4676fc..1e2f691e3 100644 --- a/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc +++ b/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc @@ -302,6 +302,18 @@ class opsigeneric extends plugin $this->hostId = get_post('hostId'); } + /* Send actions like 'install' or 'wake' to the si server + */ + if(isset($_POST['opsi_action']) && isset($_POST['opsi_trigger_action']) && $this->parent_mode){ + $action = $_POST['opsi_action']; + if(in_array($action,array("wake","install"))){ + $this->opsi->send_action($action,$this->hostId); + if($this->opsi->is_error()){ + msg_dialog::display(_("Error"),msgPool::siError($this->opsi->get_error()),ERROR_DIALOG); + } + } + } + if(isset($_POST['opsi_netboot_product'])){ $SNP = trim($_POST['opsi_netboot_product']); if(isset($this->a_availableNetbootProducts[$SNP])){ @@ -336,6 +348,13 @@ class opsigeneric extends plugin } } + + function install_client() + { + + } + + /* Return plugin informations for acl handling */ static function plInfo() { -- 2.30.2