From 14362101fb69504bd1c63cc69b839622c05f19a7 Mon Sep 17 00:00:00 2001 From: rettenbe Date: Wed, 27 Feb 2008 09:22:46 +0000 Subject: [PATCH] new function: recreate_fai_server_db git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9157 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/modules/DBsqlite.pm | 13 +++++++++++++ gosa-si/modules/GosaPackages.pm | 6 +++--- gosa-si/server/events/gosaTriggered.pm | 13 +++++++++++++ gosa-si/tests/client.php | 5 +++-- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/gosa-si/modules/DBsqlite.pm b/gosa-si/modules/DBsqlite.pm index 60a3b0bbc..8bd357fb6 100644 --- a/gosa-si/modules/DBsqlite.pm +++ b/gosa-si/modules/DBsqlite.pm @@ -282,5 +282,18 @@ sub count_dbentries { +sub move_table { + my ($self, $from, $to) = @_; + + my $sql_statement_drop = "DROP TABLE IF EXISTS $to"; + my $sql_statement_alter = "ALTER TABLE $from RENAME TO $to"; + &create_lock($self,'move_table'); + my $db_res = $self->{dbh}->do($sql_statement_drop); + $db_res = $self->{dbh}->do($sql_statement_alter); + &remove_lock($self,'move_table'); + + return; +} + 1; diff --git a/gosa-si/modules/GosaPackages.pm b/gosa-si/modules/GosaPackages.pm index 747f93a95..ec8f6d0eb 100644 --- a/gosa-si/modules/GosaPackages.pm +++ b/gosa-si/modules/GosaPackages.pm @@ -303,7 +303,7 @@ sub process_incoming_msg { sub process_gosa_msg { my ($msg, $msg_hash, $session_id) = @_ ; my $out_msg; - my @out_msg_l; + my @out_msg_l = (); my $header = @{$msg_hash->{'header'}}[0]; $header =~ s/gosa_//; @@ -332,9 +332,9 @@ sub process_gosa_msg { # if delivery not possible raise error and return if( not @out_msg_l ) { - &main::daemon_log("ERROR: GosaPackages: no event handler or core function defined for $header", 1); + &main::daemon_log("WARNING: GosaPackages got not answer from event handler '$header'", 3); } elsif( 0 == @out_msg_l) { - &main::daemon_log("ERROR: GosaPackages got not answer from event_handler $header", 1); + &main::daemon_log("ERROR: GosaPackages: no event handler or core function defined for '$header'", 1); } return @out_msg_l; diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index f8185db75..d722c90b3 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -25,6 +25,7 @@ my @events = ( "trigger_action_instant_update", "trigger_action_rescan", "trigger_action_wake", + "recreate_fai_server_db", ); @EXPORT = @events; @@ -51,6 +52,17 @@ sub get_events { } +sub recreate_fai_server_db { + my ($msg, $msg_hash, $session_id) = @_ ; + + $main::fai_server_db->create_table("new_fai_server", \@main::fai_server_col_names); + &main::create_fai_server_db("new_fai_server"); + $main::fai_server_db->move_table("new_fai_server", $main::fai_server_tn); + + return; +} + + sub get_login_usr_for_client { my ($msg, $msg_hash, $session_id) = @_ ; my $header = @{$msg_hash->{'header'}}[0]; @@ -113,6 +125,7 @@ sub gen_smb_hash { my %data= ('hash' => join(q[:], ntlmgen $password)); my $out_msg = &build_msg("gen_smb_hash", $target, 'GOSA', \%data ); + return; } diff --git a/gosa-si/tests/client.php b/gosa-si/tests/client.php index c1820fb43..6f045cd67 100755 --- a/gosa-si/tests/client.php +++ b/gosa-si/tests/client.php @@ -18,7 +18,7 @@ if($sock->connected()){ # jobdb add #$data = "
gosa_network_completition
GOSAGOSAws-muc-2
"; #$data = "
job_sayHello
10.89.1.155:2008300:1B:77:04:8A:6C 20130102133900
"; -$data = "
job_ping
10.89.1.155:20083 10.89.1.155:2008100:01:6c:9d:b9:fa 20130102133900
"; +#$data = "
job_ping
10.89.1.155:20083 10.89.1.155:2008100:01:6c:9d:b9:fa 20130102133900
"; # jobdb delete #$data = "
gosa_delete_jobdb_entry
3
"; @@ -79,7 +79,8 @@ $data = "
job_ping
10.89.1.155:20083 write($data); $answer = "nothing"; -- 2.30.2