Code

update
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 Mar 2008 16:28:55 +0000 (16:28 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 Mar 2008 16:28:55 +0000 (16:28 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9903 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/modules/DBsqlite.pm
gosa-si/modules/SIPackages.pm
gosa-si/server/events/clMessages.pm

index 2032db279b100b7469c2892da23ca85ee788ef49..0b5cd69dd522ff98d2360a8b49ab7bcdc7592217 100644 (file)
@@ -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');
index 7ee752072f553f6f864efb872c32985b4e4a3829..5efc73cd9982fa0661d647e7fe9cc13803db8a03 100644 (file)
@@ -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);
index e197b73d51135f164e2993af60bdf32734e9b496..5fdcd06ea4f507abeedb2be6945fe4133304a62d 100644 (file)
@@ -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
 #  <CLMSG_TASKBEGIN>finish</CLMSG_TASKBEGIN>
 #  <header>CLMSG_TASKBEGIN</header>