From 2e1a7f272ac8f39bc8ebe2e6c33fe7bdd63ab03d Mon Sep 17 00:00:00 2001 From: rettenbe Date: Tue, 3 Jun 2008 14:43:30 +0000 Subject: [PATCH] * bugfix: gosaTriggered.pm: all functions work now git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11177 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-server | 16 ++++++++--- gosa-si/server/events/gosaTriggered.pm | 38 +++++++++++++------------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index cbf152842..14918ba32 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -101,8 +101,6 @@ our $forground; our $cfg_file; our ($ldap_uri, $ldap_base, $ldap_admin_dn, $ldap_admin_password, $ldap_server_dn); -# Where should new systems be placed -our $new_systems_ou; # specifies the verbosity of the daemon_log $verbose = 0 ; @@ -243,7 +241,6 @@ my $max_children = 2; "job-queue-loop-delay" => [\$job_queue_loop_delay, 3], "messaging-db-loop-delay" => [\$messaging_db_loop_delay, 3], "key" => [\$GosaPackages_key, "none"], - "new-systems-ou" => [\$new_systems_ou, "ou=systems"], }, "ClientPackages" => { "key" => [\$ClientPackages_key, "none"], @@ -1267,6 +1264,7 @@ sub process_task { my $client_answer = ""; # prepare all variables needed to process message + #my $msg = $task->{'xmlmessage'}; my $msg = &decode_base64($task->{'xmlmessage'}); my $incoming_id = $task->{'id'}; my $module = $task->{'module'}; @@ -1902,6 +1900,10 @@ sub change_fai_state { if ($mesg->count) { my @entries = $mesg->entries; + if (0 == @entries) { + daemon_log("$session_id ERROR: ldap search failed: ldap_base=$ldap_base, filter=$search", 1); + } + foreach my $entry (@entries) { # Only modify entry if it is not set to '$state' if ($entry->get_value("FAIstate") ne "$state"){ @@ -1930,12 +1932,16 @@ sub change_fai_state { daemon_log("$session_id DEBUG FAIstate at host '".$entry->dn."' already at state '$st'", 7); } } + } else { + daemon_log("$session_id ERROR: LDAP search failed: ldap_base=$ldap_base, filter=$search", 1); } + # if no ldap handle defined } else { daemon_log("$session_id ERROR: no LDAP handle defined for update FAIstate", 1); } + return; } @@ -1988,7 +1994,9 @@ sub change_goto_state { } } - } + } else { + daemon_log("$session_id ERROR: LDAP search failed: ldap_base=$ldap_base, filter=$search", 1); + } } } diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index 11bd7417c..1b278a52b 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -519,15 +519,15 @@ sub set_activated_for_installation { sub trigger_action_faireboot { my ($msg, $msg_hash, $session_id) = @_; - my $macaddress = @{$msg_hash->{target}}[0]; + my $macaddress = @{$msg_hash->{macaddress}}[0]; my $source = @{$msg_hash->{source}}[0]; my @out_msg_l; $msg =~ s/
gosa_trigger_action_faireboot<\/header>/
trigger_action_faireboot<\/header>/; push(@out_msg_l, $msg); - &main::change_goto_state('locked', \@{$msg_hash->{target}}, $session_id); - &main::change_fai_state('install', \@{$msg_hash->{target}}, $session_id); + &main::change_goto_state('locked', \@{$msg_hash->{macaddress}}, $session_id); + &main::change_fai_state('install', \@{$msg_hash->{macaddress}}, $session_id); # delete all jobs from jobqueue which correspond to fai my $sql_statement = "DELETE FROM $main::job_queue_tn WHERE (macaddress='$macaddress' AND ". @@ -540,10 +540,10 @@ sub trigger_action_faireboot { sub trigger_action_lock { my ($msg, $msg_hash, $session_id) = @_; - my $macaddress = @{$msg_hash->{target}}[0]; + my $macaddress = @{$msg_hash->{macaddress}}[0]; my $source = @{$msg_hash->{source}}[0]; - &main::change_goto_state('locked', \@{$msg_hash->{target}}, $session_id); + &main::change_goto_state('locked', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; @@ -558,10 +558,10 @@ sub trigger_action_lock { sub trigger_action_activate { my ($msg, $msg_hash, $session_id) = @_; - my $macaddress = @{$msg_hash->{target}}[0]; + my $macaddress = @{$msg_hash->{macaddress}}[0]; my $source = @{$msg_hash->{source}}[0]; - &main::change_goto_state('active', \@{$msg_hash->{target}}, $session_id); + &main::change_goto_state('active', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; @@ -582,7 +582,7 @@ sub trigger_action_activate { sub trigger_action_localboot { my ($msg, $msg_hash, $session_id) = @_; $msg =~ s/
gosa_trigger_action_localboot<\/header>/
trigger_action_localboot<\/header>/; - &main::change_fai_state('localboot', \@{$msg_hash->{target}}, $session_id); + &main::change_fai_state('localboot', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; @@ -599,7 +599,7 @@ sub trigger_action_halt { my ($msg, $msg_hash, $session_id) = @_; $msg =~ s/
gosa_trigger_action_halt<\/header>/
trigger_action_halt<\/header>/; - &main::change_fai_state('halt', \@{$msg_hash->{target}}, $session_id); + &main::change_fai_state('halt', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; @@ -616,7 +616,7 @@ sub trigger_action_reboot { my ($msg, $msg_hash, $session_id) = @_; $msg =~ s/
gosa_trigger_action_reboot<\/header>/
trigger_action_reboot<\/header>/; - &main::change_fai_state('reboot', \@{$msg_hash->{target}}, $session_id); + &main::change_fai_state('reboot', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; @@ -633,7 +633,7 @@ sub trigger_action_memcheck { my ($msg, $msg_hash, $session_id) = @_ ; $msg =~ s/
gosa_trigger_action_memcheck<\/header>/
trigger_action_memcheck<\/header>/; - &main::change_fai_state('memcheck', \@{$msg_hash->{target}}, $session_id); + &main::change_fai_state('memcheck', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; @@ -650,9 +650,9 @@ sub trigger_action_reinstall { my ($msg, $msg_hash, $session_id) = @_; $msg =~ s/
gosa_trigger_action_reinstall<\/header>/
trigger_action_reinstall<\/header>/; - &main::change_fai_state('reinstall', \@{$msg_hash->{target}}, $session_id); + &main::change_fai_state('reinstall', \@{$msg_hash->{macaddress}}, $session_id); - my %data = ( 'macAddress' => \@{$msg_hash->{target}} ); + my %data = ( 'macAddress' => \@{$msg_hash->{macaddress}} ); my $wake_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data); my @out_msg_l = ($wake_msg, $msg); return @out_msg_l; @@ -663,9 +663,9 @@ sub trigger_action_update { my ($msg, $msg_hash, $session_id) = @_; $msg =~ s/
gosa_trigger_action_update<\/header>/
trigger_action_update<\/header>/; - &main::change_fai_state('update', \@{$msg_hash->{target}}, $session_id); + &main::change_fai_state('update', \@{$msg_hash->{macaddress}}, $session_id); - my %data = ( 'macAddress' => \@{$msg_hash->{target}} ); + my %data = ( 'macAddress' => \@{$msg_hash->{macaddress}} ); my $wake_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data); my @out_msg_l = ($wake_msg, $msg); return @out_msg_l; @@ -676,7 +676,7 @@ sub trigger_action_instant_update { my ($msg, $msg_hash, $session_id) = @_; $msg =~ s/
gosa_trigger_action_instant_update<\/header>/
trigger_action_instant_update<\/header>/; - &main::change_fai_state('update', \@{$msg_hash->{target}}, $session_id); + &main::change_fai_state('update', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { @@ -685,7 +685,7 @@ sub trigger_action_instant_update { my $res = $main::job_db->exec_statement($sql_statement); } - my %data = ( 'macAddress' => \@{$msg_hash->{target}} ); + my %data = ( 'macAddress' => \@{$msg_hash->{macaddress}} ); my $wake_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data); my @out_msg_l = ($wake_msg, $msg); return @out_msg_l; @@ -696,7 +696,7 @@ sub trigger_action_sysinfo { my ($msg, $msg_hash, $session_id) = @_; $msg =~ s/
gosa_trigger_action_sysinfo<\/header>/
trigger_action_sysinfo<\/header>/; - &main::change_fai_state('sysinfo', \@{$msg_hash->{target}}, $session_id); + &main::change_fai_state('sysinfo', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; @@ -753,7 +753,7 @@ sub trigger_action_wake { } - my %data = ( 'macAddress' => \@{$msg_hash->{target}} ); + my %data = ( 'macAddress' => \@{$msg_hash->{macaddress}} ); my $out_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data); my @out_msg_l = ($out_msg); return @out_msg_l; -- 2.30.2