Code

new function: recreate_fai_server_db
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Feb 2008 09:22:46 +0000 (09:22 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Feb 2008 09:22:46 +0000 (09:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9157 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/modules/DBsqlite.pm
gosa-si/modules/GosaPackages.pm
gosa-si/server/events/gosaTriggered.pm
gosa-si/tests/client.php

index 60a3b0bbc66733883d34e97cb04406e3bac9ecad..8bd357fb69b2acf34ee0491855685907b601228e 100644 (file)
@@ -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;
index 747f93a955da077c1e4ec95ad8a529a3fb3b0115..ec8f6d0eb5bf285a0cb25836abf4a7a22d6d57ef 100644 (file)
@@ -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;
index f8185db75b21e7a4af1eb4130714086b55681b0f..d722c90b3402ebb74b811f82260d1eb749fd048f 100644 (file)
@@ -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;
 }
 
 
index c1820fb4386c57556cb5f4797053b16243f73a22..6f045cd67fb10c20ed10b578bd126842501006cf 100755 (executable)
@@ -18,7 +18,7 @@ if($sock->connected()){
 # jobdb add
 #$data = "<xml> <header>gosa_network_completition</header> <source>GOSA</source><target>GOSA</target><hostname>ws-muc-2</hostname></xml>";
 #$data = "<xml> <header>job_sayHello</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
-$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source> <target>10.89.1.155:20081</target><macaddress>00:01:6c:9d:b9:fa</macaddress> <timestamp>20130102133900</timestamp> </xml>";
+#$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source> <target>10.89.1.155:20081</target><macaddress>00:01:6c:9d:b9:fa</macaddress> <timestamp>20130102133900</timestamp> </xml>";
 
 # jobdb delete
 #$data = "<xml> <header>gosa_delete_jobdb_entry</header><where><clause><phrase><id>3</id></phrase></clause></where></xml>";
@@ -79,7 +79,8 @@ $data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source> <tar
 # get_client_for_login_usr
 #$data = "<xml> <header>gosa_get_client_for_login_usr</header> <target>GOSA</target> <source>GOSA</source> <usr>harald</usr></xml>";
 
-
+# recreate_fai_server_db
+$data = "<xml> <header>gosa_recreate_fai_server_db</header> <target>GOSA</target> <source>GOSA</source></xml>"; 
 
     $sock->write($data);
     $answer = "nothing";