Code

bugfix: delete comment lines, function opsi_install_client still have complete functi...
[gosa.git] / gosa-si / server / events / opsi_com.pm
1 ## @file
2 # @details A GOsa-SI-server event module containing all functions for message handling.
3 # @brief Implementation of an event module for GOsa-SI-server. 
6 package opsi_com;
7 use Exporter;
8 @ISA = qw(Exporter);
9 my @events = (
10     "get_events",
11     "opsi_install_client",
12     "opsi_get_netboot_products",  
13     "opsi_get_local_products",
14     "opsi_get_client_hardware",
15     "opsi_get_client_software",
16     "opsi_get_product_properties",
17     "opsi_set_product_properties",
18     "opsi_list_clients",
19     "opsi_del_client",
21    );
22 @EXPORT = @events;
24 use strict;
25 use warnings;
26 use GOSA::GosaSupportDaemon;
27 use Data::Dumper;
28 use XML::Quote qw(:all);
31 BEGIN {}
33 END {}
35 ## @method get_events()
36 # A brief function returning a list of functions which are exported by importing the module.
37 # @return List of all provided functions
38 sub get_events {
39     return \@events;
40 }
42     
43 ## @method opsi_get_netboot_products
44 # ???
45 # @param msg - STRING - xml message with tag hostId
46 # @param msg_hash - HASHREF - message information parsed into a hash
47 # @param session_id - INTEGER - POE session id of the processing of this message
48 sub opsi_get_netboot_products {
49   my ($msg, $msg_hash, $session_id) = @_;
50   my $header = @{$msg_hash->{'header'}}[0];
51   my $source = @{$msg_hash->{'source'}}[0];
52   my $target = @{$msg_hash->{'target'}}[0];
53   my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
54   my $hostId;
56   # build return message with twisted target and source
57   my $out_hash = &main::create_xml_hash("answer_$header", $target, $source);
58   if (defined $forward_to_gosa) {
59     &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
60   }
62   # Get hostID if defined
63   if (defined @{$msg_hash->{'hostId'}}[0]){
64     $hostId = @{$msg_hash->{'hostId'}}[0];
65     &add_content2xml_hash($out_hash, "hostId", $hostId);
66   }
68   &add_content2xml_hash($out_hash, "xxx", "");
69   my $xml_msg= &create_xml_string($out_hash);
71   # For hosts, only return the products that are or get installed
72   my $callobj;
73   $callobj = {
74     method  => 'getNetBootProductIds_list',
75     params  => [ ],
76     id  => 1,
77   };
79   my $res = $main::opsi_client->call($main::opsi_url, $callobj);
80   my %r = ();
81   for (@{$res->result}) { $r{$_} = 1 }
83   if (&main::check_opsi_res($res)){
85     if (defined $hostId){
86       $callobj = {
87         method  => 'getProductStates_hash',
88         params  => [ $hostId ],
89         id  => 1,
90       };
92       my $hres = $main::opsi_client->call($main::opsi_url, $callobj);
93       if (&main::check_opsi_res($hres)){
94         my $htmp= $hres->result->{$hostId};
96         # check state != not_installed or action == setup -> load and add
97         foreach my $product (@{$htmp}){
99           if (!defined ($r{$product->{'productId'}})){
100             next;
101           }
103           # Now we've a couple of hashes...
104           if ($product->{'installationStatus'} ne "not_installed" or
105               $product->{'actionRequest'} eq "setup"){
106             my $state= "<state>".$product->{'installationStatus'}."</state><action>".$product->{'actionRequest'}."</action>";
108             $callobj = {
109               method  => 'getProduct_hash',
110               params  => [ $product->{'productId'} ],
111               id  => 1,
112             };
114             my $sres = $main::opsi_client->call($main::opsi_url, $callobj);
115             if (&main::check_opsi_res($sres)){
116               my $tres= $sres->result;
118               my $name= xml_quote($tres->{'name'});
119               my $r= $product->{'productId'};
120               my $description= xml_quote($tres->{'description'});
121               $name=~ s/\//\\\//;
122               $description=~ s/\//\\\//;
123               $xml_msg=~ s/<xxx><\/xxx>/<item><ProductId>$r<\/ProductId><name><\/name><description>$description<\/description><\/item>$state<xxx><\/xxx>/;
124             }
126           }
127         }
129       }
131     } else {
132       foreach my $r (@{$res->result}) {
133         $callobj = {
134           method  => 'getProduct_hash',
135           params  => [ $r ],
136           id  => 1,
137         };
139         my $sres = $main::opsi_client->call($main::opsi_url, $callobj);
140         if (&main::check_opsi_res($sres)){
141           my $tres= $sres->result;
143           my $name= xml_quote($tres->{'name'});
144           my $description= xml_quote($tres->{'description'});
145           $name=~ s/\//\\\//;
146           $description=~ s/\//\\\//;
147           $xml_msg=~ s/<xxx><\/xxx>/<item><ProductId>$r<\/ProductId><name><\/name><description>$description<\/description><\/item><xxx><\/xxx>/;
148         }
150       }
152     }
153   }
155   $xml_msg=~ s/<xxx><\/xxx>//;
157   return ($xml_msg);
161 ## @method opsi_get_product_properties
162 # ???
163 # @param msg - STRING - xml message with tags ProductId and hostId
164 # @param msg_hash - HASHREF - message information parsed into a hash
165 # @param session_id - INTEGER - POE session id of the processing of this message
166 sub opsi_get_product_properties {
167     my ($msg, $msg_hash, $session_id) = @_;
168     my $header = @{$msg_hash->{'header'}}[0];
169     my $source = @{$msg_hash->{'source'}}[0];
170     my $target = @{$msg_hash->{'target'}}[0];
171     my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
172     my $productId = @{$msg_hash->{'ProductId'}}[0];
173     my $hostId;
175     # build return message with twisted target and source
176     my $out_hash = &main::create_xml_hash("answer_$header", $target, $source);
178     # Get hostID if defined
179     if (defined @{$msg_hash->{'hostId'}}[0]){
180       $hostId = @{$msg_hash->{'hostId'}}[0];
181       &add_content2xml_hash($out_hash, "hostId", $hostId);
182     }
184     if (defined $forward_to_gosa) {
185       &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
186     }
187     &add_content2xml_hash($out_hash, "ProducId", "$productId");
189     # Load actions
190     my $callobj = {
191       method  => 'getPossibleProductActions_list',
192       params  => [ $productId ],
193       id  => 1,
194     };
195     my $res = $main::opsi_client->call($main::opsi_url, $callobj);
196     if (&main::check_opsi_res($res)){
197       foreach my $action (@{$res->result}){
198         &add_content2xml_hash($out_hash, "action", $action);
199       }
200     }
202     # Add place holder
203     &add_content2xml_hash($out_hash, "xxx", "");
205     # Move to XML string
206     my $xml_msg= &create_xml_string($out_hash);
208     # JSON Query
209     $callobj = {
210       method  => 'getProductProperties_hash',
211       params  => [ $productId ],
212       id  => 1,
213     };
215     $res = $main::opsi_client->call($main::opsi_url, $callobj);
217     if (&main::check_opsi_res($res)){
218         my $r= $res->result;
219         foreach my $key (keys %{$r}) {
220           my $item= "<item>";
221           my $value= $r->{$key};
222           if (UNIVERSAL::isa( $value, "ARRAY" )){
223             foreach my $subval (@{$value}){
224               $item.= "<$key>".xml_quote($subval)."</$key>";
225             }
226           } else {
227             $item.= "<$key>".xml_quote($value)."</$key>";
228           }
229           $item.= "</item>";
230           $xml_msg=~ s/<xxx><\/xxx>/$item<xxx><\/xxx>/;
231         }
232     }
235   $xml_msg=~ s/<xxx><\/xxx>//;
237   return ($xml_msg);
241 ## @method opsi_set_product_properties
242 # ???
243 # @param msg - STRING - xml message with tags ProductId, hostId, action and state
244 # @param msg_hash - HASHREF - message information parsed into a hash
245 # @param session_id - INTEGER - POE session id of the processing of this message
246 sub opsi_set_product_properties {
247     my ($msg, $msg_hash, $session_id) = @_;
248     my $header = @{$msg_hash->{'header'}}[0];
249     my $source = @{$msg_hash->{'source'}}[0];
250     my $target = @{$msg_hash->{'target'}}[0];
251     my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
252     my $productId = @{$msg_hash->{'ProductId'}}[0];
253     my $hostId;
255     # build return message with twisted target and source
256     my $out_hash = &main::create_xml_hash("answer_$header", $target, $source);
257     &add_content2xml_hash($out_hash, "ProductId", $productId);
259     # Get hostID if defined
260     if (defined @{$msg_hash->{'hostId'}}[0]){
261       $hostId = @{$msg_hash->{'hostId'}}[0];
262       &add_content2xml_hash($out_hash, "hostId", $hostId);
263     }
265     # Set product states if requested
266     if (defined @{$msg_hash->{'action'}}[0]){
267       &_set_action($productId, @{$msg_hash->{'action'}}[0], $hostId);
268     }
269     if (defined @{$msg_hash->{'state'}}[0]){
270       &_set_state($productId, @{$msg_hash->{'state'}}[0], $hostId);
271     }
273     if (defined $forward_to_gosa) {
274         &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
275     }
277     # Find properties
278     foreach my $item (@{$msg_hash->{'item'}}){
279       # JSON Query
280       my $callobj;
282       if (defined $hostId){
283         $callobj = {
284           method  => 'setProductProperty',
285           params  => [ $productId, $item->{'name'}[0], $item->{'value'}[0], $hostId ],
286           id  => 1,
287         };
288       } else {
289         $callobj = {
290           method  => 'setProductProperty',
291           params  => [ $productId, $item->{'name'}[0], $item->{'value'}[0] ],
292           id  => 1,
293         };
294       }
296       my $res = $main::opsi_client->call($main::opsi_url, $callobj);
298       if (!&main::check_opsi_res($res)){
299         &main::daemon_log("ERROR: no communication failed while setting '".$item->{'name'}[0]."': ".$res->error_message, 1);
300         &add_content2xml_hash($out_hash, "error", $res->error_message);
301       }
303     }
305     # return message
306     return ( &create_xml_string($out_hash) );
310 ## @method opsi_get_client_hardware
311 # ???
312 # @param msg - STRING - xml message with tag hostId
313 # @param msg_hash - HASHREF - message information parsed into a hash
314 # @param session_id - INTEGER - POE session id of the processing of this message
315 sub opsi_get_client_hardware {
316     my ($msg, $msg_hash, $session_id) = @_;
317     my $header = @{$msg_hash->{'header'}}[0];
318     my $source = @{$msg_hash->{'source'}}[0];
319     my $target = @{$msg_hash->{'target'}}[0];
320     my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
321     my $hostId = @{$msg_hash->{'hostId'}}[0];
323     # build return message with twisted target and source
324     my $out_hash = &main::create_xml_hash("answer_$header", $target, $source);
326     if (defined $forward_to_gosa) {
327       &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
328     }
329     &add_content2xml_hash($out_hash, "hostId", "$hostId");
330     &add_content2xml_hash($out_hash, "xxx", "");
331     my $xml_msg= &create_xml_string($out_hash);
333     # JSON Query
334     my $callobj = {
335       method  => 'getHardwareInformation_hash',
336       params  => [ $hostId ],
337       id  => 1,
338     };
340     my $res = $main::opsi_client->call($main::opsi_url, $callobj);
341     if (&main::check_opsi_res($res)){
342       my $result= $res->result;
343       foreach my $r (keys %{$result}){
344         my $item= "<item><id>".xml_quote($r)."</id>";
345         my $value= $result->{$r};
346         foreach my $sres (@{$value}){
348           foreach my $dres (keys %{$sres}){
349             if (defined $sres->{$dres}){
350               $item.= "<$dres>".xml_quote($sres->{$dres})."</$dres>";
351             }
352           }
354         }
355           $item.= "</item>";
356           $xml_msg=~ s%<xxx></xxx>%$item<xxx></xxx>%;
358       }
359     }
361     $xml_msg=~ s/<xxx><\/xxx>//;
363     return ( $xml_msg );
367 ## @method opsi_list_clients
368 # ???
369 # @param msg - STRING - xml message 
370 # @param msg_hash - HASHREF - message information parsed into a hash
371 # @param session_id - INTEGER - POE session id of the processing of this message
372 sub opsi_list_clients {
373     my ($msg, $msg_hash, $session_id) = @_;
374     my $header = @{$msg_hash->{'header'}}[0];
375     my $source = @{$msg_hash->{'source'}}[0];
376     my $target = @{$msg_hash->{'target'}}[0];
377     my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
379     # build return message with twisted target and source
380     my $out_hash = &main::create_xml_hash("answer_$header", $target, $source);
382     if (defined $forward_to_gosa) {
383       &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
384     }
386     &add_content2xml_hash($out_hash, "xxx", "");
387     my $xml_msg= &create_xml_string($out_hash);
389     # JSON Query
390     my $callobj = {
391       method  => 'getClients_listOfHashes',
392       params  => [ ],
393       id  => 1,
394     };
396     my $res = $main::opsi_client->call($main::opsi_url, $callobj);
397     if (&main::check_opsi_res($res)){
399       foreach my $host (@{$res->result}){
400         my $item= "<item><name>".$host->{'hostId'}."</name>";
401         if (defined($host->{'description'})){
402           $item.= "<description>".xml_quote($host->{'description'})."</description>";
403         }
404         $item.= "</item>";
405         $xml_msg=~ s%<xxx></xxx>%$item<xxx></xxx>%;
406       }
408     }
410     $xml_msg=~ s/<xxx><\/xxx>//;
411     return ( $xml_msg );
415 ## @method opsi_get_client_software
416 # ???
417 # @param msg - STRING - xml message with tag hostId
418 # @param msg_hash - HASHREF - message information parsed into a hash
419 # @param session_id - INTEGER - POE session id of the processing of this message
420 sub opsi_get_client_software {
421     my ($msg, $msg_hash, $session_id) = @_;
422     my $header = @{$msg_hash->{'header'}}[0];
423     my $source = @{$msg_hash->{'source'}}[0];
424     my $target = @{$msg_hash->{'target'}}[0];
425     my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
426     my $hostId = @{$msg_hash->{'hostId'}}[0];
428     # build return message with twisted target and source
429     my $out_hash = &main::create_xml_hash("answer_$header", $target, $source);
431     if (defined $forward_to_gosa) {
432       &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
433     }
434     &add_content2xml_hash($out_hash, "hostId", "$hostId");
435     &add_content2xml_hash($out_hash, "xxx", "");
436     my $xml_msg= &create_xml_string($out_hash);
438     # JSON Query
439     my $callobj = {
440       method  => 'getSoftwareInformation_hash',
441       params  => [ $hostId ],
442       id  => 1,
443     };
445     my $res = $main::opsi_client->call($main::opsi_url, $callobj);
446     if (&main::check_opsi_res($res)){
447       my $result= $res->result;
448     }
450     $xml_msg=~ s/<xxx><\/xxx>//;
452     return ( $xml_msg );
456 ## @method opsi_get_local_products
457 # ???
458 # @param msg - STRING - xml message with tag hostId
459 # @param msg_hash - HASHREF - message information parsed into a hash
460 # @param session_id - INTEGER - POE session id of the processing of this message
461 sub opsi_get_local_products {
462   my ($msg, $msg_hash, $session_id) = @_;
463   my $header = @{$msg_hash->{'header'}}[0];
464   my $source = @{$msg_hash->{'source'}}[0];
465   my $target = @{$msg_hash->{'target'}}[0];
466   my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
467   my $hostId;
469   # build return message with twisted target and source
470   my $out_hash = &main::create_xml_hash("answer_$header", $target, $source);
472   # Get hostID if defined
473   if (defined @{$msg_hash->{'hostId'}}[0]){
474     $hostId = @{$msg_hash->{'hostId'}}[0];
475     &add_content2xml_hash($out_hash, "hostId", $hostId);
476   }
478   if (defined $forward_to_gosa) {
479     &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
480   }
481   &add_content2xml_hash($out_hash, "xxx", "");
482   my $xml_msg= &create_xml_string($out_hash);
484   # For hosts, only return the products that are or get installed
485   my $callobj;
486   $callobj = {
487     method  => 'getLocalBootProductIds_list',
488     params  => [ ],
489     id  => 1,
490   };
492   my $res = $main::opsi_client->call($main::opsi_url, $callobj);
493   my %r = ();
494   for (@{$res->result}) { $r{$_} = 1 }
496   if (&main::check_opsi_res($res)){
498     if (defined $hostId){
499       $callobj = {
500         method  => 'getProductStates_hash',
501         params  => [ $hostId ],
502         id  => 1,
503       };
505       my $hres = $main::opsi_client->call($main::opsi_url, $callobj);
506       if (&main::check_opsi_res($hres)){
507         my $htmp= $hres->result->{$hostId};
509         # check state != not_installed or action == setup -> load and add
510         foreach my $product (@{$htmp}){
512           if (!defined ($r{$product->{'productId'}})){
513             next;
514           }
516           # Now we've a couple of hashes...
517           if ($product->{'installationStatus'} ne "not_installed" or
518               $product->{'actionRequest'} eq "setup"){
519             my $state= "<state>".$product->{'installationStatus'}."</state><action>".$product->{'actionRequest'}."</action>";
521             $callobj = {
522               method  => 'getProduct_hash',
523               params  => [ $product->{'productId'} ],
524               id  => 1,
525             };
527             my $sres = $main::opsi_client->call($main::opsi_url, $callobj);
528             if (&main::check_opsi_res($sres)){
529               my $tres= $sres->result;
531               my $name= xml_quote($tres->{'name'});
532               my $r= $product->{'productId'};
533               my $description= xml_quote($tres->{'description'});
534               $name=~ s/\//\\\//;
535               $description=~ s/\//\\\//;
536               $xml_msg=~ s/<xxx><\/xxx>/<item><ProductId>$r<\/ProductId><name><\/name><description>$description<\/description><\/item>$state<xxx><\/xxx>/;
537             }
539           }
540         }
542       }
544     } else {
545       foreach my $r (@{$res->result}) {
546         $callobj = {
547           method  => 'getProduct_hash',
548           params  => [ $r ],
549           id  => 1,
550         };
552         my $sres = $main::opsi_client->call($main::opsi_url, $callobj);
553         if (&main::check_opsi_res($sres)){
554           my $tres= $sres->result;
556           my $name= xml_quote($tres->{'name'});
557           my $description= xml_quote($tres->{'description'});
558           $name=~ s/\//\\\//;
559           $description=~ s/\//\\\//;
560           $xml_msg=~ s/<xxx><\/xxx>/<item><ProductId>$r<\/ProductId><name><\/name><description>$description<\/description><\/item><xxx><\/xxx>/;
561         }
563       }
565     }
566   }
568   $xml_msg=~ s/<xxx><\/xxx>//;
570   return ( $xml_msg );
574 ## @method opsi_del_client
575 # ???
576 # @param msg - STRING - xml message with tag hostId
577 # @param msg_hash - HASHREF - message information parsed into a hash
578 # @param session_id - INTEGER - POE session id of the processing of this message
579 sub opsi_del_client {
580     my ($msg, $msg_hash, $session_id) = @_;
581     my $header = @{$msg_hash->{'header'}}[0];
582     my $source = @{$msg_hash->{'source'}}[0];
583     my $target = @{$msg_hash->{'target'}}[0];
584     my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
585     my $hostId = @{$msg_hash->{'hostId'}}[0];
587     # build return message with twisted target and source
588     my $out_hash = &main::create_xml_hash("answer_$header", $target, $source);
590     if (defined $forward_to_gosa) {
591       &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
592     }
593     &add_content2xml_hash($out_hash, "hostId", "$hostId");
595     # JSON Query
596     my $callobj = {
597       method  => 'deleteClient',
598       params  => [ $hostId ],
599       id  => 1,
600     };
602     my $res = $main::opsi_client->call($main::opsi_url, $callobj);
604     my $xml_msg= &create_xml_string($out_hash);
605     return ( $xml_msg );
609 ## @method opsi_install_client
610 # ???
611 # @param msg - STRING - xml message with tags hostId, macaddress
612 # @param msg_hash - HASHREF - message information parsed into a hash
613 # @param session_id - INTEGER - POE session id of the processing of this message
614 sub opsi_install_client {
615     my ($msg, $msg_hash, $session_id) = @_;
616     my $header = @{$msg_hash->{'header'}}[0];
617     my $source = @{$msg_hash->{'source'}}[0];
618     my $target = @{$msg_hash->{'target'}}[0];
619     my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
620     my $hostId = @{$msg_hash->{'hostId'}}[0];
621     my $error = 0;
622     my @out_msg_l;
624     # If no macaddress is specified, raise error  
625     my $macaddress; 
626     if ((exists $msg_hash->{'macaddress'}) && 
627             ($msg_hash->{'macaddress'}[0] =~ /^([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})$/i)) {  
628         $macaddress = $1; 
629     } else { 
630         $error ++; 
631         my $out_msg = "<xml>". 
632             "<header>answer</header>". 
633             "<source>$main::server_address</source>". 
634             "<target>GOSA</target>". 
635             "<answer1>1</answer1>". 
636             "<error_string>no mac address specified in macaddres-tag</error_string>". 
637             "</xml>"; 
638         push(@out_msg_l, $out_msg);
639     } 
641     # Set parameters in opsi
642     if (not $error) {
643         # build return message with twisted target and source
644         my $out_hash = &main::create_xml_hash("answer_$header", $target, $source);
646         if (defined $forward_to_gosa) {
647             &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
648         }
649         &add_content2xml_hash($out_hash, "hostId", "$hostId");
651         # Load all products for this host with status != "not_installed" or actionRequest != "none"
652         if (defined $hostId){
653             my $callobj = {
654                 method  => 'getProductStates_hash',
655                 params  => [ $hostId ],
656                 id  => 1,
657             };
659             my $hres = $main::opsi_client->call($main::opsi_url, $callobj);
660             if (&main::check_opsi_res($hres)){
661                 my $htmp= $hres->result->{$hostId};
663                 # check state != not_installed or action == setup -> load and add
664                 foreach my $product (@{$htmp}){
665                     # Now we've a couple of hashes...
666                     if ($product->{'installationStatus'} ne "not_installed" or
667                             $product->{'actionRequest'} ne "none"){
669                         # Do an action request for all these -> "setup".
670                         $callobj = {
671                             method  => 'setProductActionRequest',
672                             params  => [ $product->{'productId'}, $hostId, "setup" ],
673                             id  => 1,
674                         };
675                         my $res = $main::opsi_client->call($main::opsi_url, $callobj);
676                         if (!&main::check_opsi_res($res)){
677                             &main::daemon_log("ERROR: cannot set product action request for $hostId!", 1);
678                         } else {
679                             &main::daemon_log("INFO: requesting 'setup' for '".$product->{'productId'}."' on $hostId", 1);
680                         }
682                     }
683                 }
684             }
685         }
687         push(@out_msg_l, &create_xml_string($out_hash));
688     }
690     # Build wakeup message for client
691     if (not $error) {
692         my $wakeup_hash = &create_xml_hash("trigger_wake", "GOSA", "KNOWN_SERVER");
693         &add_content2xml_hash($wakeup_hash, 'macAddress', $macaddress);
694         my $wakeup_msg = &create_xml_string($wakeup_hash);
695         push(@out_msg_l, $wakeup_msg);
697         # invoke trigger wake for this gosa-si-server
698         &main::server_server_com::trigger_wake($wakeup_msg, $wakeup_hash, $session_id);
699     }
702     return @out_msg_l;
706 ## @method _set_action
707 # ???
708 # @param product - STRING - ???
709 # @param action - STRING - ???
710 # @param hostId - STRING - ???
711 sub _set_action {
712   my $product= shift;
713   my $action = shift;
714   my $hostId = shift;
715   my $callobj;
717   $callobj = {
718     method  => 'setProductActionRequest',
719     params  => [ $product, $hostId, $action],
720     id  => 1,
721   };
723   $main::opsi_client->call($main::opsi_url, $callobj);
726 ## @method _set_state
727 # ???
728 # @param product - STRING - ???
729 # @param action - STRING - ???
730 # @param hostId - STRING - ???
731 sub _set_state {
732   my $product = shift;
733   my $hostId = shift;
734   my $action = shift;
735   my $callobj;
737   $callobj = {
738     method  => 'setProductState',
739     params  => [ $product, $hostId, $action ],
740     id  => 1,
741   };
743   $main::opsi_client->call($main::opsi_url, $callobj);
746 1;