diff --git a/gosa-plugins/opsi/admin/opsi/class_opsi.inc b/gosa-plugins/opsi/admin/opsi/class_opsi.inc
index b0f6bbb1251d1523fbbfd7e2329c74da6e5b9ca2..a60ce9085464a6a735a91787dbcceec0a2f2e345 100644 (file)
$this->target = "00:01:6c:9d:b9:fa";
}
+
+ public function enabled()
+ {
+ return(TRUE);
+ }
/******************
Opsi handling
function get_hosts_for_system_management()
{
$res = $this->list_clients();
-
$data = array();
foreach($res as $entry){
if(!isset($entry['MAC'][0]['VALUE'])) $entry['MAC'][0]['VALUE'] = "";
}
+ /*! \brief Trigger an event like wake or install for a specific hostId.
+ */
+ public function send_action($type,$hostId,$mac)
+ {
+ switch($type){
+ case 'install' : $this->job_opsi_install_client($hostId,$mac); break;
+ default : trigger_error('Unknown type '.$type.'.');
+ }
+ }
+
+
/******************
SI Communication functions
******************/
@param
@return
*/
- public function del_client()
+ public function del_client($hostId)
{
- /* <xml>
- <header>gosa_opsi_del_client</header>
- <source>GOSA</source>
- <target>00:01:6c:9d:b9:fa</target>
- <hostId>limux-cl-2.intranet.gonicus.de</hostId>
- </xml>
- */
+ $data = array("hostId" => $hostId);
+
+ /* Check parameter */
+ if(empty($hostId)){
+ trigger_error("No valid host id given, check parameter 1.");
+ return;
+ }
+
+ /* Query SI server */
+ $res = $this->send_data("gosa_opsi_del_client",$this->target,$data,TRUE);
+ if(isset($res['XML'][0]['ITEM'])){
+ return($res['XML'][0]['ITEM']);
+ }
+ return(array());
}
@param
@return
*/
- public function job_opsi_install_client()
+ public function job_opsi_install_client($hostId,$mac)
{
- /* <xml>
- <header>job_opsi_install_client</header>
- <source>GOSA</source>
- <target>00:01:6c:9d:b9:fa</target>
- <hostId>limux-cl-2.intranet.gonicus.de</hostId>
- <macaddress>00:11:25:4b:8c:e5</macaddress>
- </xml>
- */
+ $data = array("hostId" => $hostId,"macaddress"=>$mac);
+
+ /* Check parameter */
+ if(empty($hostId)){
+ trigger_error("No valid host id given, check parameter 1.");
+ return;
+ }
+
+ /* Query SI server */
+ $this->send_data("job_opsi_install_client",$this->target,$data,TRUE);
}
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: