From: rettenbe Date: Tue, 19 Feb 2008 13:12:01 +0000 (+0000) Subject: new event module X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d26d6aa80ec0729c5d6853427dd4681279b4e21a;p=gosa.git new event module git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8955 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm new file mode 100644 index 000000000..fcde81eee --- /dev/null +++ b/gosa-si/server/events/gosaTriggered.pm @@ -0,0 +1,146 @@ +package gosaTriggered; +use Exporter; +@ISA = qw(Exporter); +my @events = ( + "get_events", + "ping", + "set_activated_for_installation", + "new_key_for_client", + "detect_hardware", + "trigger_action_localboot", + "trigger_action_reboot", + "trigger_action_halt", + "trigger_action_update", + "trigger_action_reinstall", + "trigger_action_memcheck", + "trigger_action_sysinfo", + "trigger_action_instant_update", + "trigger_action_rescan", + ); +@EXPORT = @events; + +use strict; +use warnings; +use GOSA::GosaSupportDaemon; + + +BEGIN {} + +END {} + +### Start ###################################################################### + +#&main::read_configfile($main::cfg_file, %cfg_defaults); + +sub get_events { + return \@events; +} + +sub ping { + my ($msg, $msg_hash, $session_id) = @_ ; + my $source = @{$msg_hash->{source}}[0]; + my $target = @{$msg_hash->{target}}[0]; + my $out_hash = &create_xml_hash("ping", $source, $target); + &add_content2xml_hash($out_hash, "session_id", $session_id); + my $out_msg = &create_xml_string($out_hash); + + return ( $out_msg ); +} + +sub detect_hardware { + my ($msg, $msg_hash) = @_ ; + # just forward msg to client, but dont forget to split off 'gosa_' in header + my $header = @{$msg_hash->{header}}[0]; + my $source = @{$msg_hash->{source}}[0]; + my $target = @{$msg_hash->{target}}[0]; + + my $out_hash = &create_xml_hash("detect_hardware", $source, $target); + my $out_msg = &create_xml_string($out_hash); + + return ( $out_msg ); +} + + +sub set_activated_for_installation { + my ($msg, $msg_hash) = @_; + + my $header = @{$msg_hash->{header}}[0]; + my $source = @{$msg_hash->{source}}[0]; + my $target = @{$msg_hash->{target}}[0]; + + my $out_hash = &create_xml_hash("set_activated_for_installation", $source, $target); + my $out_msg = &create_xml_string($out_hash); + + return ( $out_msg ); +} + +sub trigger_action_localboot { + my ($msg, $msg_hash) = @_; + $msg =~ s/
gosa_trigger_action_localboot<\/header>/
trigger_action_localboot<\/header>/; + + return ( $msg ); +} + +sub trigger_action_halt { + my ($msg, $msg_hash) = @_; + $msg =~ s/
gosa_trigger_action_halt<\/header>/
trigger_action_halt<\/header>/; + return ( $msg ); +} + + +sub trigger_action_reboot { + my ($msg, $msg_hash) = @_; + $msg =~ s/
gosa_trigger_action_reboot<\/header>/
trigger_action_reboot<\/header>/; + return ( $msg ); +} + + +sub trigger_action_memcheck { + my ($msg, $msg_hash) = @_ ; + $msg =~ s/
gosa_trigger_action_memcheck<\/header>/
trigger_action_memcheck<\/header>/; + return ( $msg ); +} + + +sub trigger_action_reinstall { + my ($msg, $msg_hash) = @_; + $msg =~ s/
gosa_trigger_action_reinstall<\/header>/
trigger_action_reinstall<\/header>/; + return ( $msg ); +} + + +sub trigger_action_update { + my ($msg, $msg_hash) = @_; + $msg =~ s/
gosa_trigger_action_update<\/header>/
trigger_action_update<\/header>/; + return ( $msg ); +} + + +sub trigger_action_instant_update { + my ($msg, $msg_hash) = @_; + $msg =~ s/
gosa_trigger_action_instant_update<\/header>/
trigger_action_instant_update<\/header>/; + return ( $msg ); +} + + +sub trigger_action_sysinfo { + my ($msg, $msg_hash) = @_; + $msg =~ s/
gosa_trigger_action_sysinfo<\/header>/
trigger_action_sysinfo<\/header>/; + return ( $msg ); +} + + + +sub new_key_for_client { + my ($msg, $msg_hash) = @_; + $msg =~ s/
gosa_new_key_for_client<\/header>/
new_key<\/header>/; + return ( $msg ); +} + +sub trigger_action_rescan { + my ($msg, $msg_hash) = @_; + $msg =~ s/
gosa_trigger_action_rescan<\/header>/
trigger_action_rescan<\/header>/; + return ( $msg ); +} + +1;