From a3dbef5b8fe7684f844ac50e4295496f12ce8121 Mon Sep 17 00:00:00 2001 From: janw Date: Tue, 15 Apr 2008 08:19:05 +0000 Subject: [PATCH] Added event "gosa_recreate_fai_release_db" 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 | 8 ++++++-- gosa-si/server/events/gosaTriggered.pm | 23 ++++++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index cb243deff..8a69ca418 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -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( diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index 29e1a7b9e..d1c1cdf9e 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -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]; -- 2.30.2