Code

update and bugfix: adjust 'db-check' scripts and gosa-si to mysql
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 22 Sep 2008 12:58:59 +0000 (12:58 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 22 Sep 2008 12:58:59 +0000 (12:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12530 594d385d-05f5-0310-b6e9-bd551577e9d8

15 files changed:
gosa-si/client/events/gosaTriggered.pm
gosa-si/gosa-si-server
gosa-si/modules/DBmysql.pm
gosa-si/modules/GosaSupportDaemon.pm
gosa-si/server/events/gosaTriggered.pm
gosa-si/tests/db-check-clients.pl
gosa-si/tests/db-check-fai-release.pl
gosa-si/tests/db-check-fai-server.pl
gosa-si/tests/db-check-foreign-clients.pl
gosa-si/tests/db-check-incoming.pl
gosa-si/tests/db-check-jobs.pl
gosa-si/tests/db-check-messaging.pl
gosa-si/tests/db-check-packages-list.pl
gosa-si/tests/db-check-server.pl
gosa-si/tests/db-check-users.pl

index 3caffff15ea00dd70a72826978e8822ff82c72b7..fd954cab135f12df93dc320670424189d6ab8ad4 100644 (file)
@@ -41,6 +41,7 @@ my @events = (
     "trigger_action_reinstall",
     "trigger_action_update",
     "trigger_action_instant_update",
+    "trigger_goto_settings_reload",
     );
 @EXPORT = @events;
 
@@ -495,5 +496,14 @@ sub trigger_action_instant_update {
     return;
 }
 
+sub trigger_goto_settings_reload {
+    my ($msg, $msg_hash) = @_;
+
+    # Execute goto settings reload
+    system("/etc/init.d/goto-configure start");
+    
+    return;
+}
+
 
 1;
index ca826949bf5d726bd8b37cb1b349ec577244efee..7d91b4dc422b1ebd2ea0c81f1a863512a155c735 100755 (executable)
@@ -3159,54 +3159,54 @@ daemon_log($server_status_hash->{$server_status}.": $server_revision", 1);
 
 # connect to incoming_db
 unlink($incoming_file_name);
-$incoming_db = GOSA::DBmysql->new($incoming_file_name);
+$incoming_db = GOSA::DBmysql->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password);
 $incoming_db->create_table($incoming_tn, \@incoming_col_names);
 
 # connect to gosa-si job queue
 unlink($job_queue_file_name);  ## just for debugging
-$job_db = GOSA::DBmysql->new($job_queue_file_name);
+$job_db = GOSA::DBmysql->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password);
 $job_db->create_table($job_queue_tn, \@job_queue_col_names);
 chmod(0660, $job_queue_file_name);
 chown($root_uid, $adm_gid, $job_queue_file_name);
 
 # connect to known_clients_db
 unlink($known_clients_file_name);   ## just for debugging
-$known_clients_db = GOSA::DBmysql->new($known_clients_file_name);
+$known_clients_db = GOSA::DBmysql->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password);
 $known_clients_db->create_table($known_clients_tn, \@known_clients_col_names);
 chmod(0660, $known_clients_file_name);
 chown($root_uid, $adm_gid, $known_clients_file_name);
 
 # connect to foreign_clients_db
 unlink($foreign_clients_file_name);
-$foreign_clients_db = GOSA::DBmysql->new($foreign_clients_file_name);
+$foreign_clients_db = GOSA::DBmysql->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password);
 $foreign_clients_db->create_table($foreign_clients_tn, \@foreign_clients_col_names);
 chmod(0660, $foreign_clients_file_name);
 chown($root_uid, $adm_gid, $foreign_clients_file_name);
 
 # connect to known_server_db
 unlink($known_server_file_name);
-$known_server_db = GOSA::DBmysql->new($known_server_file_name);
+$known_server_db = GOSA::DBmysql->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password);
 $known_server_db->create_table($known_server_tn, \@known_server_col_names);
 chmod(0660, $known_server_file_name);
 chown($root_uid, $adm_gid, $known_server_file_name);
 
 # connect to login_usr_db
 unlink($login_users_file_name);
-$login_users_db = GOSA::DBmysql->new($login_users_file_name);
+$login_users_db = GOSA::DBmysql->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password);
 $login_users_db->create_table($login_users_tn, \@login_users_col_names);
 chmod(0660, $login_users_file_name);
 chown($root_uid, $adm_gid, $login_users_file_name);
 
 # connect to fai_server_db 
 unlink($fai_server_file_name);
-$fai_server_db = GOSA::DBmysql->new($fai_server_file_name);
+$fai_server_db = GOSA::DBmysql->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password);
 $fai_server_db->create_table($fai_server_tn, \@fai_server_col_names);
 chmod(0660, $fai_server_file_name);
 chown($root_uid, $adm_gid, $fai_server_file_name);
 
 # connect to fai_release_db
 unlink($fai_release_file_name);
-$fai_release_db = GOSA::DBmysql->new($fai_release_file_name);
+$fai_release_db = GOSA::DBmysql->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password);
 $fai_release_db->create_table($fai_release_tn, \@fai_release_col_names);
 chmod(0660, $fai_release_file_name);
 chown($root_uid, $adm_gid, $fai_release_file_name);
@@ -3214,14 +3214,14 @@ chown($root_uid, $adm_gid, $fai_release_file_name);
 # connect to packages_list_db
 #unlink($packages_list_file_name);
 unlink($packages_list_under_construction);
-$packages_list_db = GOSA::DBmysql->new($packages_list_file_name);
+$packages_list_db = GOSA::DBmysql->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password);
 $packages_list_db->create_table($packages_list_tn, \@packages_list_col_names);
 chmod(0660, $packages_list_file_name);
 chown($root_uid, $adm_gid, $packages_list_file_name);
 
 # connect to messaging_db
 unlink($messaging_file_name);
-$messaging_db = GOSA::DBmysql->new($messaging_file_name);
+$messaging_db = GOSA::DBmysql->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password);
 $messaging_db->create_table($messaging_tn, \@messaging_col_names);
 chmod(0660, $messaging_file_name);
 chown($root_uid, $adm_gid, $messaging_file_name);
index 6d5648d9e00472fa20d2077a86178f536662c1fc..4c3dd589d5cf20f5c7ef4ef4b4a72ee90ebee786 100644 (file)
@@ -11,9 +11,13 @@ my $col_names = {};
 
 sub new {
     my $class = shift;
+    my $database = shift;
+    my $host = shift;
+    my $username = shift;
+    my $password = shift;
 
     my $self = {dbh=>undef};
-    my $dbh = DBI->connect("dbi:mysql:database=$main::mysql_database;host=$main::mysql_host", $main::mysql_username, $main::mysql_password,{ RaiseError => 1, AutoCommit => 1 });
+    my $dbh = DBI->connect("dbi:mysql:database=$database;host=$host", $username, $password,{ RaiseError => 1, AutoCommit => 1 });
                $dbh->{mysql_auto_reconnect} = 1;
     $self->{dbh} = $dbh;
     bless($self,$class);
index 056fdc4e5e90ca2252d71afc351bf504912225ad..8551a1782367677e8bfb506a16ed1757dca19dff 100644 (file)
@@ -181,9 +181,10 @@ sub add_content2xml_hash {
 
 sub get_time {
        # Add an optional offset in seconds
-       my $offset = $1 if shift =~ /^(\d+)$/ || 0;
+       #my $offset = $1 if shift =~ /^(\d+)$/ || 0;
        my ($seconds, $minutes, $hours, $monthday, $month,
-               $year, $weekday, $yearday, $sommertime) = localtime(time+$offset);
+               #$year, $weekday, $yearday, $sommertime) = localtime(time+$offset);
+               $year, $weekday, $yearday, $sommertime) = localtime;
        $hours = $hours < 10 ? $hours = "0".$hours : $hours;
        $minutes = $minutes < 10 ? $minutes = "0".$minutes : $minutes;
        $seconds = $seconds < 10 ? $seconds = "0".$seconds : $seconds;
index e91aa4639d7eb7ab9ea45362e71116ccc038b3c0..2e48db88275f5f3517ec6d849a816e2d57ae4456 100644 (file)
@@ -1223,6 +1223,5 @@ sub get_hosts_with_module {
 }
 
 
-
 # vim:ts=4:shiftwidth:expandtab
 1;
index 1b197ba141da615621a3a11ba9c481bf5aa9b599..e3027465d8a25faa67c04050ffadebeaf02169b1 100755 (executable)
 
 use strict;
 use warnings;
-use GOSA::DBsqlite;
+use GOSA::DBmysql;
 use Data::Dumper;
 
 print "START\n";
-my $res;
-my $db_name;
-
-    
-$db_name = "/var/lib/gosa-si/clients.db";
-if (-e $db_name) {
-    print "\n############################################################\n";
-    my $table_name = "known_clients";
-    print "$db_name\n";
-    print "$table_name\n";
-
-    my $sqlite = GOSA::DBsqlite->new($db_name);
-    my $col_names = $sqlite->get_table_columns($table_name);
-    print join(', ', @{ $col_names } )."\n" ;
-    my $answer = $sqlite->show_table($table_name);
-    print $answer."\n";
-}
+my $table_name = "known_clients";
+
+print "\n############################################################\n";
+print "$table_name\n";
+
+my $dbh = GOSA::DBmysql->new('gosa_si', '127.0.0.1', 'gosa_si', 'gosa');
+
+my $col_names = $dbh->get_table_columns($table_name);
+print join(', ', @{ $col_names } )."\n" ;
+
+my $answer = $dbh->show_table($table_name);
+print $answer."\n";
 
 
 print "\nFINISH\n";
index efb73d61a23f836040b20ce756d4a7f53c9bd63f..ac4503dc4157544688807348480bd05fffd6180c 100755 (executable)
 
 use strict;
 use warnings;
-use GOSA::DBsqlite;
+use GOSA::DBmysql;
 use Data::Dumper;
 
 print "START\n";
-my $res;
-my $db_name;
-
-$db_name = "/var/lib/gosa-si/fai_release.db";
-if (-e $db_name) {
-    print "\n############################################################\n";
-    my $table_name = "fai_release";
-    print "$db_name\n";
-    print "$table_name\n";
-
-    my $sqlite = GOSA::DBsqlite->new($db_name);
-    my $col_names = $sqlite->get_table_columns($table_name);
-    print join(', ', @{ $col_names } )."\n" ;
-    my $answer = $sqlite->show_table($table_name);
-    print $answer."\n";
-}
+my $table_name = "fai_release";
+
+print "\n############################################################\n";
+print "$table_name\n";
+
+my $dbh = GOSA::DBmysql->new('gosa_si', '127.0.0.1', 'gosa_si', 'gosa');
+
+my $col_names = $dbh->get_table_columns($table_name);
+print join(', ', @{ $col_names } )."\n" ;
+
+my $answer = $dbh->show_table($table_name);
+print $answer."\n";
+
 
 print "\nFINISH\n";
index 1d237e8245b1bb2c2e31f1dd60b1631b6daf9bd2..1d6add484d156f39f60a0c86384e0bb913a47d41 100755 (executable)
 
 use strict;
 use warnings;
-use GOSA::DBsqlite;
+use GOSA::DBmysql;
 use Data::Dumper;
 
 print "START\n";
-my $res;
-my $db_name;
-
-$db_name = "/var/lib/gosa-si/fai_server.db";
-if (-e $db_name) {
-    print "\n############################################################\n";
-    my $table_name = "fai_server";
-    print "$db_name\n";
-    print "$table_name\n";
-
-    my $sqlite = GOSA::DBsqlite->new($db_name);
-    my $col_names = $sqlite->get_table_columns($table_name);
-    print join(', ', @{ $col_names } )."\n" ;
-    my $answer = $sqlite->show_table($table_name);
-    print $answer."\n";
-}
+my $table_name = "fai_server";
+
+print "\n############################################################\n";
+print "$table_name\n";
+
+my $dbh = GOSA::DBmysql->new('gosa_si', '127.0.0.1', 'gosa_si', 'gosa');
+
+my $col_names = $dbh->get_table_columns($table_name);
+print join(', ', @{ $col_names } )."\n" ;
+
+my $answer = $dbh->show_table($table_name);
+print $answer."\n";
+
 
 print "\nFINISH\n";
index e3ebba80e282b745a4c079d7d3f7473351565f56..95c420c9ea5a68948bb4a5f9b9d3db62782237ad 100755 (executable)
 
 use strict;
 use warnings;
-use GOSA::DBsqlite;
+use GOSA::DBmysql;
 use Data::Dumper;
 
 print "START\n";
-my $res;
-my $db_name;
-
-    
-$db_name = "/var/lib/gosa-si/foreign_clients.db";
-if (-e $db_name) {
-    print "\n############################################################\n";
-    my $table_name = "foreign_clients";
-    print "$db_name\n";
-    print "$table_name\n";
-
-    my $sqlite = GOSA::DBsqlite->new($db_name);
-    my $col_names = $sqlite->get_table_columns($table_name);
-    print join(', ', @{ $col_names } )."\n" ;
-    my $answer = $sqlite->show_table($table_name);
-    print $answer."\n";
-}
+my $table_name = "foreign_clients";
+
+print "\n############################################################\n";
+print "$table_name\n";
+
+my $dbh = GOSA::DBmysql->new('gosa_si', '127.0.0.1', 'gosa_si', 'gosa');
+
+my $col_names = $dbh->get_table_columns($table_name);
+print join(', ', @{ $col_names } )."\n" ;
+
+my $answer = $dbh->show_table($table_name);
+print $answer."\n";
 
 
 print "\nFINISH\n";
index 03a40e12d2d783c81119ac23a45d09c6c4221c88..014b22c97bdcbaf21a505f850d3c761ee4950e54 100755 (executable)
 
 use strict;
 use warnings;
-use GOSA::DBsqlite;
+use GOSA::DBmysql;
 use Data::Dumper;
 
 print "START\n";
-my $res;
-my $db_name;
-
-    
-$db_name = "/var/lib/gosa-si/incoming.db";
-if (-e $db_name) {
-    print "\n############################################################\n";
-    my $table_name = "incoming";
-    print "$db_name\n";
-    print "$table_name\n";
-    my $sqlite = GOSA::DBsqlite->new($db_name);
-    my $col_names = $sqlite->get_table_columns($table_name);
-
-    print join(', ', @{ $col_names } )."\n" ;
-    my $answer = $sqlite->show_table($table_name);
-    print $answer."\n";
-}
+my $table_name = "incoming";
+
+print "\n############################################################\n";
+print "$table_name\n";
+
+my $dbh = GOSA::DBmysql->new('gosa_si', '127.0.0.1', 'gosa_si', 'gosa');
+
+my $col_names = $dbh->get_table_columns($table_name);
+print join(', ', @{ $col_names } )."\n" ;
+
+my $answer = $dbh->show_table($table_name);
+print $answer."\n";
 
 
 print "\nFINISH\n";
index b80039b62ed529901c69d5eb61d1cf9444b059d9..5ecbe49a9855eaf70a9c678793967b06a261da01 100755 (executable)
 
 use strict;
 use warnings;
-use GOSA::DBsqlite;
+use GOSA::DBmysql;
 use Data::Dumper;
 
 print "START\n";
-my $res;
-my $db_name;
-
+my $table_name = "jobs";
     
-$db_name = "/var/lib/gosa-si/jobs.db";
-if (-e $db_name) {
-    print "\n############################################################\n";
-    my $table_name = "jobs";
-    print "$db_name\n";
-    print "$table_name\n";
-    my $sqlite = GOSA::DBsqlite->new($db_name);
-    my $col_names = $sqlite->get_table_columns($table_name);
+print "\n############################################################\n";
+print "$table_name\n";
+
+my $dbh = GOSA::DBmysql->new('gosa_si', '127.0.0.1', 'gosa_si', 'gosa');
+
+my $col_names = $dbh->get_table_columns($table_name);
+print join(', ', @{ $col_names } )."\n" ;
 
-    print join(', ', @{ $col_names } )."\n" ;
-    my $answer = $sqlite->show_table($table_name);
-    print $answer."\n";
-}
+my $answer = $dbh->show_table($table_name);
+print $answer."\n";
 
 
 print "\nFINISH\n";
index f7244ad8c81a54da7a79c0daf80650ca8a851c7a..08e45280acd39ce40ce9a1fc0dd70db73d476c1a 100755 (executable)
 
 use strict;
 use warnings;
-use GOSA::DBsqlite;
-
+use GOSA::DBmysql;
+use Data::Dumper;
 
 print "START\n";
-my $res;
-my $db_name;
-
-    
-$db_name = "/var/lib/gosa-si/messaging.db";
-if (-e $db_name) {
-    print "\n############################################################\n";
-    my $table_name = "messaging";
-    print "$db_name\n";
-    print "$table_name\n";
-    my $sqlite = GOSA::DBsqlite->new($db_name);
-    my $col_names = $sqlite->get_table_columns($table_name);
-    print join(', ', @{ $col_names } )."\n" ;
-    my $answer = $sqlite->show_table($table_name);
-    print $answer."\n";
-}
+my $table_name = "messaging";
+
+print "\n############################################################\n";
+print "$table_name\n";
+
+my $dbh = GOSA::DBmysql->new('gosa_si', '127.0.0.1', 'gosa_si', 'gosa');
+
+my $col_names = $dbh->get_table_columns($table_name);
+print join(', ', @{ $col_names } )."\n" ;
+
+my $answer = $dbh->show_table($table_name);
+print $answer."\n";
+
 
 print "\nFINISH\n";
index d01644e197d0d5313db674e8a8f5aaf711b1c177..e99c5e068b5ed8609a2a5a816b191c97636888b6 100755 (executable)
 
 use strict;
 use warnings;
-use GOSA::DBsqlite;
+use GOSA::DBmysql;
 use Data::Dumper;
 
 print "START\n";
-my $res;
-my $db_name;
-
-
-$db_name = "/var/lib/gosa-si/packages.db";
-if (-e $db_name) {
-    print "\n############################################################\n";
-    my $table_name = "packages_list";
-    print "$db_name\n";
-    print "$table_name\n";
-
-    my $sqlite = GOSA::DBsqlite->new($db_name);
-    my $col_names = $sqlite->get_table_columns($table_name);
-    print join(', ', @{ $col_names } )."\n" ;
-    my $answer = $sqlite->show_table($table_name);
-    print $answer."\n";
-}
+my $table_name = "packages_list";
+
+print "\n############################################################\n";
+print "$table_name\n";
+
+my $dbh = GOSA::DBmysql->new('gosa_si', '127.0.0.1', 'gosa_si', 'gosa');
+
+my $col_names = $dbh->get_table_columns($table_name);
+print join(', ', @{ $col_names } )."\n" ;
+
+my $answer = $dbh->show_table($table_name);
+print $answer."\n";
 
 
 print "\nFINISH\n";
index 18f59d7b56f281721030809846e33859612d1890..f0caeca3e235611c94db9ef5db69f62921803208 100755 (executable)
 
 use strict;
 use warnings;
-use GOSA::DBsqlite;
+use GOSA::DBmysql;
 use Data::Dumper;
 
 print "START\n";
-my $res;
-my $db_name;
-
-    
-$db_name = "/var/lib/gosa-si/servers.db";
-if (-e $db_name) {
-    print "\n############################################################\n";
-    my $table_name = "known_server";
-    print "$db_name\n";
-    print "$table_name\n";
-
-    my $sqlite = GOSA::DBsqlite->new($db_name);
-    my $col_names = $sqlite->get_table_columns($table_name);
-    print join(', ', @{ $col_names } )."\n" ;
-    my $answer = $sqlite->show_table($table_name);
-    print $answer."\n";
-}
+my $table_name = "known_server";
+
+print "\n############################################################\n";
+print "$table_name\n";
+
+my $dbh = GOSA::DBmysql->new('gosa_si', '127.0.0.1', 'gosa_si', 'gosa');
+
+my $col_names = $dbh->get_table_columns($table_name);
+print join(', ', @{ $col_names } )."\n" ;
+
+my $answer = $dbh->show_table($table_name);
+print $answer."\n";
+
 
 print "\nFINISH\n";
index 1f49f8cc5e8d8357c04d8977e333fde3f1b224a7..c86be7c31a66a69591f0a744626cac65f6bbb2cb 100755 (executable)
 
 use strict;
 use warnings;
-use GOSA::DBsqlite;
+use GOSA::DBmysql;
 use Data::Dumper;
 
 print "START\n";
-my $res;
-my $db_name;
+my $table_name = "login_users";
 
-    
+print "\n############################################################\n";
+print "$table_name\n";
 
+my $dbh = GOSA::DBmysql->new('gosa_si', '127.0.0.1', 'gosa_si', 'gosa');
 
-$db_name = "/var/lib/gosa-si/users.db";
-if (-e $db_name) {
-    print "\n############################################################\n";
-    my $table_name = "login_users";
-    print "$db_name\n";
-    print "$table_name\n";
+my $col_names = $dbh->get_table_columns($table_name);
+print join(', ', @{ $col_names } )."\n" ;
 
-    my $sqlite = GOSA::DBsqlite->new($db_name);
-    my $col_names = $sqlite->get_table_columns($table_name);
-    print join(', ', @{ $col_names } )."\n" ;
-    my $answer = $sqlite->show_table($table_name);
-    print $answer."\n";
-}
+my $answer = $dbh->show_table($table_name);
+print $answer."\n";
 
 
 print "\nFINISH\n";