Code

Added event "gosa_recreate_fai_release_db"
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 Apr 2008 08:19:05 +0000 (08:19 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 Apr 2008 08:19:05 +0000 (08:19 +0000)
Added option to create_fai_server_db to not create packages list if wanted.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10446 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-server
gosa-si/server/events/gosaTriggered.pm

index cb243deff3879981da39f477314cdf26463fae52..8a69ca4182244fd9eb8711f2ad255f24177d5462 100755 (executable)
@@ -1598,7 +1598,7 @@ sub change_goto_state {
 
 
 sub create_fai_server_db {
-    my ($table_name, $kernel) = @_;
+    my ($table_name, $kernel, $dont_create_packages_list) = @_;
        my $result;
     my $ldap_handle = &get_ldap_handle();
        if(defined($ldap_handle)) {
@@ -1632,7 +1632,9 @@ sub create_fai_server_db {
                daemon_log("INFO: create_fai_server_db: finished", 5);
 
                # TODO: Find a way to post the 'create_packages_list_db' event
-               &create_packages_list_db($ldap_handle);
+               if(!defined($dont_create_packages_list)) {
+                       &create_packages_list_db($ldap_handle);
+               }
        }       
     
     $ldap_handle->disconnect;
@@ -1704,6 +1706,8 @@ sub create_fai_release_db {
     $ldap_handle->disconnect;
        return $result;
 }
+
+
 sub run_create_fai_release_db {
     my ($session, $heap, $table_name) = @_[SESSION, HEAP, ARG0];
     my $task = POE::Wheel::Run->new(
index 29e1a7b9ea2cc1f96d4e9e98f857a81ba5eed27e..d1c1cdf9e7e7bdd2f1a73a48b02189798721e0e1 100644 (file)
@@ -28,6 +28,7 @@ my @events = (
     "trigger_action_rescan",
     "trigger_action_wake",
     "recreate_fai_server_db",
+    "recreate_fai_release_db",
     "send_user_msg", 
        "get_available_kernel",
     );
@@ -205,7 +206,7 @@ sub recreate_fai_server_db {
     }
 
     $main::fai_server_db->create_table("new_fai_server", \@main::fai_server_col_names);
-    &main::create_fai_server_db("new_fai_server");
+    &main::create_fai_server_db("new_fai_server",undef,"dont");
     $main::fai_server_db->move_table("new_fai_server", $main::fai_server_tn);
 
     my @out_msg_l = ( $out_msg );
@@ -213,6 +214,26 @@ sub recreate_fai_server_db {
 }
 
 
+sub recreate_fai_release_db {
+    my ($msg, $msg_hash, $session_id) = @_ ;
+    my $out_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'";
+        &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+        my $res = $main::job_db->exec_statement($sql_statement);
+    }
+
+    $main::fai_server_db->create_table("new_fai_release", \@main::fai_release_col_names);
+    &main::create_fai_release_db("new_fai_release");
+    $main::fai_server_db->move_table("new_fai_release", $main::fai_release_tn);
+
+    my @out_msg_l = ( $out_msg );
+    return @out_msg_l;
+}
+
+
 sub get_login_usr_for_client {
     my ($msg, $msg_hash, $session_id) = @_ ;
     my $header = @{$msg_hash->{'header'}}[0];