From af7a66946b874d3cb73235e90b97a302bddd30ef Mon Sep 17 00:00:00 2001 From: rettenbe Date: Mon, 17 Mar 2008 16:28:55 +0000 Subject: [PATCH] update git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9903 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/modules/DBsqlite.pm | 8 +-- gosa-si/modules/SIPackages.pm | 4 +- gosa-si/server/events/clMessages.pm | 83 ++++++++++++++++++----------- 3 files changed, 58 insertions(+), 37 deletions(-) diff --git a/gosa-si/modules/DBsqlite.pm b/gosa-si/modules/DBsqlite.pm index 2032db279..0b5cd69dd 100644 --- a/gosa-si/modules/DBsqlite.pm +++ b/gosa-si/modules/DBsqlite.pm @@ -146,15 +146,17 @@ sub add_dbentry { my $col_names = &get_table_columns($self, $table); # assign values to column name variables - my @add_list; + my @col_list; + my @val_list; foreach my $col_name (@{$col_names}) { # use function parameter for column values if (exists $arg->{$col_name}) { - push(@add_list, $arg->{$col_name}); + push(@col_list, $col_name); + push(@val_list, $arg->{$col_name}); } } - my $sql_statement = "INSERT INTO $table VALUES ('".join("', '", @add_list)."')"; + my $sql_statement = "INSERT INTO $table (".join(", ", @col_list).") VALUES (".join(", ", @val_list).")"; &create_lock($self,'add_dbentry'); my $db_res = $self->{dbh}->do($sql_statement); &remove_lock($self,'add_dbentry'); diff --git a/gosa-si/modules/SIPackages.pm b/gosa-si/modules/SIPackages.pm index 7ee752072..5efc73cd9 100644 --- a/gosa-si/modules/SIPackages.pm +++ b/gosa-si/modules/SIPackages.pm @@ -898,9 +898,9 @@ sub hardware_config { status=>'processing', result=>'none', progress=>'hardware-detection', - headertag=>$header, + headertag=>'trigger_action_reinstall', targettag=>$address, - xmlmessage=>$msg, + xmlmessage=>'none', macaddress=>$macaddress, }; my $hd_res = $main::job_db->add_dbentry($func_dic); diff --git a/gosa-si/server/events/clMessages.pm b/gosa-si/server/events/clMessages.pm index e197b73d5..5fdcd06ea 100644 --- a/gosa-si/server/events/clMessages.pm +++ b/gosa-si/server/events/clMessages.pm @@ -325,42 +325,61 @@ sub TASKBEGIN { # check if installation finished if (($content eq 'finish') || ($content eq 'faiend')){ - my $sql_statement = "UPDATE $main::job_queue_tn ". - "SET status='done', result='$header "."$content' ". - "WHERE status='processing' AND macaddress LIKE '$macaddress'"; - &main::daemon_log("$session_id DEBUG: $sql_statement", 7); - my $res = $main::job_db->update_dbentry($sql_statement); - &main::daemon_log("$session_id INFO: $header at '$macaddress' - '$content'", 5); - + my $sql_statement = "UPDATE $main::job_queue_tn ". + "SET status='done', result='$header "."$content' ". + "WHERE status='processing' AND macaddress LIKE '$macaddress'"; + &main::daemon_log("$session_id DEBUG: $sql_statement", 7); + my $res = $main::job_db->update_dbentry($sql_statement); + &main::daemon_log("$session_id INFO: $header at '$macaddress' - '$content'", 5); +# +# my $add_hash = { table=>$main::job_queue_tn, +# primkey=> ['id'], +# timestamp=>&get_time, +# status=>"'processing'", +# result=>"'$header $content'", +# progress=>"'none'", +# headertag=>"'trigger_action_reinstall'", +# targettag=>"'none'", +# xmlmessage=>"'none'", +# macaddress=>"'$macaddress'", +# }; +# my ($res, $error_str) = $main::job_db->add_dbentry( $add_hash ); +# if ($res != 0) { +# &main::daemon_log("$session_id ERROR: $res - can not add entry to $main::job_queue_tn: $error_str"); +# } else { +# &main::daemon_log("$session_id INFO: '$header' at '$macaddress' - '$content'", 5); +# } +# # set fai_state to localboot &main::change_fai_state('localboot', \@{$msg_hash->{'macaddress'}}, $session_id); } else { - -#################### -# under construction - #my $sql_statement = "UPDATE $main::job_queue_tn ". - # "SET status='processing', result='$header "."$content' ". - # "WHERE status='processing' AND macaddress LIKE '$macaddress'"; - #&main::daemon_log("$session_id DEBUG: $sql_statement", 7); - #my $res = $main::job_db->update_dbentry($sql_statement); - #&main::daemon_log("$session_id INFO: $header at '$macaddress' - '$content'", 5); - - my %add_hash = ( table=>$main::job_queue_tn, - primkey=> ['id'], - timestamp=>&get_time, - status=>'processing', - macaddress=>'$macaddress', - ); - my ($res, $error_str) = $main::job_db->add_dbentry( \%add_hash ); - if ($res != 0) { - &main::daemon_log("$session_id ERROR: can not add entry to $main::job_queue_tn: $error_str"); - } else { - &main::daemon_log("$session_id INFO: '$header' at '$macaddress' - '$content'", 5); - } -# under construction -#################### - + my $sql_statement = "UPDATE $main::job_queue_tn ". + "SET status='processing', result='$header "."$content' ". + "WHERE status='processing' AND macaddress LIKE '$macaddress'"; + &main::daemon_log("$session_id DEBUG: $sql_statement", 7); + my $res = $main::job_db->update_dbentry($sql_statement); + &main::daemon_log("$session_id INFO: $header at '$macaddress' - '$content'", 5); + +# +# my $add_hash = { table=>$main::job_queue_tn, +# primkey=> ['id'], +# timestamp=>&get_time, +# status=>"'processing'", +# result=>"'$header $content'", +# progress=>"'none'", +# headertag=>"'trigger_action_reinstall'", +# targettag=>"'none'", +# xmlmessage=>"'none'", +# macaddress=>"'$macaddress'", +# }; +# my ($res, $error_str) = $main::job_db->add_dbentry( $add_hash ); +# if ($res != 0) { +# &main::daemon_log("$session_id ERROR: $res - can not add entry to $main::job_queue_tn: $error_str"); +# } else { +# &main::daemon_log("$session_id INFO: '$header' at '$macaddress' - '$content'", 5); +# } +# # -----------------------> Update hier # finish #
CLMSG_TASKBEGIN
-- 2.30.2