From: rettenbe Date: Tue, 4 Nov 2008 15:26:29 +0000 (+0000) Subject: test update X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=69d16ada6af600b9cb92cd5ad29e2ee2e957ed23;p=gosa.git test update git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12900 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index 551dfb343..d4f321b7d 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -558,11 +558,7 @@ sub trigger_action_activate { } my $out_msg = &create_xml_string($out_hash); - my %data = ( 'macaddress' => \@{$msg_hash->{macaddress}} ); - my $wake_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data); - &main::server_server_com::trigger_wake($msg, $msg_hash, $session_id); - - my @out_msg_l = ($wake_msg, $out_msg); + my @out_msg_l = ($out_msg); return @out_msg_l; } @@ -794,6 +790,10 @@ sub get_available_kernel { return ( $out_msg ); } + my %data = ( 'macaddress' => \@{$msg_hash->{macaddress}} ); + my $wake_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data); + &main::server_server_com::trigger_wake($msg, $msg_hash, $session_id); + sub trigger_activate_new { my ($msg, $msg_hash, $session_id) = @_; @@ -810,6 +810,21 @@ sub trigger_activate_new { my $dhcp_statement= (defined($msg_hash->{'dhcp'}))?@{$msg_hash->{'dhcp'}}[0]:undef; my $jobdb_id= (defined($msg_hash->{'jobdb_id'}))?@{$msg_hash->{'jobdb_id'}}[0]:undef; + # In case that the client is sleeping, wake it up + my %data = ( 'macaddress' => $mac ); + my $wake_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data); + &main::server_server_com::trigger_wake($msg, $msg_hash, $session_id); + my $sql_statement= "SELECT * FROM $known_server_tn"; + my $query_res = $main::known_server_db->select_dbentry( $sql_statement ); + while( my ($hit_num, $hit) = each %{ $query_res } ) { + my $host_name = $hit->{hostname}; + my $host_key = $hit->{hostkey}; + $wake_msg =~ s/\S+<\/target>/$host_name<\/target>/g; + my $error = &main::send_msg_to_target($wake_msg, $host_name, $host_key, $header, $session_id); + } + + + my $ldap_handle = &main::get_ldap_handle(); my $ldap_entry; my $ogroup_entry; @@ -886,8 +901,10 @@ sub trigger_activate_new { } elsif ($ldap_mesg->count == 0) { &main::daemon_log("$session_id WARNING: No System with mac address '$mac' was found in base '".$main::ldap_base."'! Re-queuing job.", 4); - $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting' WHERE id = $jobdb_id"); - $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET timestamp = '".(&calc_timestamp(&get_time(), 'plus', 60))."' WHERE id = $jobdb_id"); + my $sql_statement = "UPDATE ".$main::job_queue_tn. + ." SET status='waiting', timestamp = '".(&calc_timestamp(&get_time(), 'plus', 60))."' ". + ." WHERE id = $jobdb_id"; + $main::job_db->exec_statement($sql_statement); return undef; }