From ea8616bf19218efdf512ba5bd9afe9c1d99a5cfb Mon Sep 17 00:00:00 2001 From: rettenbe Date: Wed, 16 Apr 2008 15:36:51 +0000 Subject: [PATCH] more comments git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10516 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/modules/DBsqlite.pm | 9 ++++----- gosa-si/modules/SIPackages.pm | 2 ++ gosa-si/server/events/clMessages.pm | 7 +++++-- gosa-si/tests/log-parser.pl | 6 ++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/gosa-si/modules/DBsqlite.pm b/gosa-si/modules/DBsqlite.pm index 3dd3882ec..a629320a1 100644 --- a/gosa-si/modules/DBsqlite.pm +++ b/gosa-si/modules/DBsqlite.pm @@ -66,7 +66,7 @@ sub add_dbentry { } my $primkeys = $arg->{'primkey'}; my $prim_statement=""; - if( 0 != @$primkeys ) { + if( 0 != @$primkeys ) { # more than one primkey exist in list my @prim_list; foreach my $primkey (@$primkeys) { if($primkey eq 'id') { @@ -98,9 +98,9 @@ sub add_dbentry { my $sql_statement = "SELECT * FROM $table $prim_statement"; my $res = @{ $self->{dbh}->selectall_arrayref($sql_statement) }; - if ($res == 0) { - # primekey is unique + # primekey is unique + if ($res == 0) { # fetch column names of table my $col_names = &get_table_columns($self, $table); @@ -121,8 +121,8 @@ sub add_dbentry { return (4, $sql_statement); } + # entry already exists, so update it } else { - # entry already exists, so update it my @update_l; while( my ($pram, $val) = each %{$arg} ) { if( $pram eq 'table' ) { next; } @@ -134,7 +134,6 @@ sub add_dbentry { my $sql_statement= "UPDATE $table $update_str $prim_statement"; my $db_res = &update_dbentry($self, $sql_statement ); - } return 0; diff --git a/gosa-si/modules/SIPackages.pm b/gosa-si/modules/SIPackages.pm index b14caeafb..02f407b70 100644 --- a/gosa-si/modules/SIPackages.pm +++ b/gosa-si/modules/SIPackages.pm @@ -872,6 +872,8 @@ sub hardware_config { &main::daemon_log("Host was not found in LDAP!", 1); # set status = hardware_detection at jobqueue if entry exists +# TODO + # resolve plain name for host my $func_dic = {table=>$main::job_queue_tn, primkey=>['id'], timestamp=>&get_time, diff --git a/gosa-si/server/events/clMessages.pm b/gosa-si/server/events/clMessages.pm index a6fad7e3d..c65c6f07a 100644 --- a/gosa-si/server/events/clMessages.pm +++ b/gosa-si/server/events/clMessages.pm @@ -354,7 +354,10 @@ sub TASKBEGIN { } } - # in case of no and more than one running jobs in queue, add on single job + # in case of no and more than one running jobs in queue, add one single job + +# TODO + # resolve plain name for host $macaddress &main::daemon_log("$session_id DEBUG: add job to queue for host '$macaddress'", 7); my $func_dic = {table=>$main::job_queue_tn, primkey=>['id'], @@ -366,7 +369,7 @@ sub TASKBEGIN { targettag=>$source, xmlmessage=>'none', macaddress=>$macaddress, - plain_name=>'none', + plainname=>'none', }; my ($err, $error_str) = $main::job_db->add_dbentry($func_dic); if ($err != 0) { diff --git a/gosa-si/tests/log-parser.pl b/gosa-si/tests/log-parser.pl index 6b9e6c2db..0efe9eab9 100755 --- a/gosa-si/tests/log-parser.pl +++ b/gosa-si/tests/log-parser.pl @@ -25,6 +25,7 @@ use Data::Dumper; my $log_file = "/home/hickert/log.gosa-si-server"; #my $log_file = "/var/log/gosa-si-server.log"; + my $within_session = 0; my $within_incoming = 0; my $within_header = 0; @@ -80,11 +81,8 @@ sub check_session { if ($line =~ /gosa-si-server (\d+) / ) { if ((defined $1) && ($1 eq $session)) { - $within_session = 1; return $line; - } else { $within_session = 0; } - } else { - if ($within_session == 1) { return $line; } + } } return; } -- 2.30.2