From: rettenbe Date: Wed, 23 Apr 2008 09:16:03 +0000 (+0000) Subject: * bugfix for gosa-si-server and gosaTriggered.pm X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=81b14440e5917bee87b11d3328a9ae86601a60ef;p=gosa.git * bugfix for gosa-si-server and gosaTriggered.pm * jobdb_id was set in all sql statements as a string, now its an integer git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10637 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index b2dff82b4..2fbc8be72 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -958,7 +958,7 @@ sub update_jobdb_status_for_send_msgs { if (not $answer =~ /
trigger_action_reinstall<\/header>/) { my $sql_statement = "UPDATE $job_queue_tn ". "SET status='error', result='can not deliver msg, please consult log file' ". - "WHERE id='$jobdb_id'"; + "WHERE id=$jobdb_id"; my $res = $job_db->update_dbentry($sql_statement); } @@ -966,7 +966,7 @@ sub update_jobdb_status_for_send_msgs { } else { my $sql_statement = "UPDATE $job_queue_tn ". "SET status='done' ". - "WHERE id='$jobdb_id' AND status='processed'"; + "WHERE id=$jobdb_id AND status='processed'"; my $res = $job_db->update_dbentry($sql_statement); } } @@ -1263,8 +1263,8 @@ sub watch_for_done_jobs { while( my ($id, $hit) = each %{$res} ) { my $jobdb_id = $hit->{id}; - my $sql_statement = "DELETE FROM $job_queue_tn WHERE id='$jobdb_id'"; - my $res = $job_db->del_dbentry($sql_statement); + my $sql_statement = "DELETE FROM $job_queue_tn WHERE id=$jobdb_id"; + my $res = $job_db->del_dbentry($sql_statement); } $kernel->delay_set('watch_for_done_jobs',$job_queue_loop_delay); @@ -1305,7 +1305,7 @@ sub watch_for_new_jobs { my $sql_statement = "SELECT * FROM $job_queue_tn WHERE macaddress LIKE '$macaddress' AND headertag='$jobdb_headertag' AND status='processing'"; my $res = $job_db->exec_statement( $sql_statement ); foreach my $hit (@{$res}) { - push @drops, "DELETE FROM $job_queue_tn WHERE id = '$jobdb_id'"; + push @drops, "DELETE FROM $job_queue_tn WHERE id=$jobdb_id"; } } else { daemon_log("J ERROR: Job without id exists for macaddress $macaddress!", 1); @@ -1351,8 +1351,9 @@ sub watch_for_new_jobs { my $func_error = &send_msg_to_target($job_msg, $server_address, $GosaPackages_key, $header, "J"); # update status in job queue to 'processing' - $sql_statement = "UPDATE $job_queue_tn SET status='processing' WHERE id='$jobdb_id'"; + $sql_statement = "UPDATE $job_queue_tn SET status='processing' WHERE id=$jobdb_id"; my $res = $job_db->update_dbentry($sql_statement); +# TODO: abfangen ob alles in ordnung ist oder nicht, wenn nicht error schmeißen # We don't want parallel processing last; diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index b84d8207c..4fba9bec6 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -73,7 +73,7 @@ sub send_user_msg { # keep job queue uptodate if necessary 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -131,7 +131,7 @@ sub send_user_msg_OLD { 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -210,7 +210,7 @@ sub recreate_fai_server_db { 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -230,7 +230,7 @@ sub recreate_fai_release_db { 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -250,7 +250,7 @@ sub recreate_packages_list_db { 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -271,7 +271,7 @@ sub get_login_usr_for_client { 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -298,7 +298,7 @@ sub get_client_for_login_usr { 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -323,7 +323,7 @@ sub ping { my $out_msg = $msg; 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -380,7 +380,7 @@ sub detect_hardware { my $target = @{$msg_hash->{target}}[0]; 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -403,7 +403,7 @@ sub trigger_reload_ldap_config { 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -429,7 +429,7 @@ sub set_activated_for_installation { # update status of job 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -475,7 +475,7 @@ sub trigger_action_lock { &main::change_goto_state('locked', \@{$msg_hash->{target}}, $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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -493,7 +493,7 @@ sub trigger_action_activate { &main::change_goto_state('active', \@{$msg_hash->{target}}, $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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -514,7 +514,7 @@ sub trigger_action_localboot { &main::change_fai_state('localboot', \@{$msg_hash->{target}}, $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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -531,7 +531,7 @@ sub trigger_action_halt { &main::change_fai_state('halt', \@{$msg_hash->{target}}, $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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -548,7 +548,7 @@ sub trigger_action_reboot { &main::change_fai_state('reboot', \@{$msg_hash->{target}}, $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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -565,7 +565,7 @@ sub trigger_action_memcheck { &main::change_fai_state('memcheck', \@{$msg_hash->{target}}, $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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -609,7 +609,7 @@ sub trigger_action_instant_update { 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -628,7 +628,7 @@ sub trigger_action_sysinfo { &main::change_fai_state('sysinfo', \@{$msg_hash->{target}}, $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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -643,7 +643,7 @@ sub new_key_for_client { 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -659,7 +659,7 @@ sub trigger_action_rescan { 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -676,7 +676,7 @@ sub trigger_action_wake { 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'"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); }