From: rettenbe Date: Mon, 22 Sep 2008 12:58:59 +0000 (+0000) Subject: update and bugfix: adjust 'db-check' scripts and gosa-si to mysql X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d0e4e120422c9c8dc7b41ec2b6444d3caac5cdc4;p=gosa.git update and bugfix: adjust 'db-check' scripts and gosa-si to mysql git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12530 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/client/events/gosaTriggered.pm b/gosa-si/client/events/gosaTriggered.pm index 3caffff15..fd954cab1 100644 --- a/gosa-si/client/events/gosaTriggered.pm +++ b/gosa-si/client/events/gosaTriggered.pm @@ -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; diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index ca826949b..7d91b4dc4 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -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); diff --git a/gosa-si/modules/DBmysql.pm b/gosa-si/modules/DBmysql.pm index 6d5648d9e..4c3dd589d 100644 --- a/gosa-si/modules/DBmysql.pm +++ b/gosa-si/modules/DBmysql.pm @@ -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); diff --git a/gosa-si/modules/GosaSupportDaemon.pm b/gosa-si/modules/GosaSupportDaemon.pm index 056fdc4e5..8551a1782 100644 --- a/gosa-si/modules/GosaSupportDaemon.pm +++ b/gosa-si/modules/GosaSupportDaemon.pm @@ -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; diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index e91aa4639..2e48db882 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -1223,6 +1223,5 @@ sub get_hosts_with_module { } - # vim:ts=4:shiftwidth:expandtab 1; diff --git a/gosa-si/tests/db-check-clients.pl b/gosa-si/tests/db-check-clients.pl index 1b197ba14..e3027465d 100755 --- a/gosa-si/tests/db-check-clients.pl +++ b/gosa-si/tests/db-check-clients.pl @@ -20,27 +20,22 @@ 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"; diff --git a/gosa-si/tests/db-check-fai-release.pl b/gosa-si/tests/db-check-fai-release.pl index efb73d61a..ac4503dc4 100755 --- a/gosa-si/tests/db-check-fai-release.pl +++ b/gosa-si/tests/db-check-fai-release.pl @@ -20,25 +20,22 @@ 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"; diff --git a/gosa-si/tests/db-check-fai-server.pl b/gosa-si/tests/db-check-fai-server.pl index 1d237e824..1d6add484 100755 --- a/gosa-si/tests/db-check-fai-server.pl +++ b/gosa-si/tests/db-check-fai-server.pl @@ -20,25 +20,22 @@ 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"; diff --git a/gosa-si/tests/db-check-foreign-clients.pl b/gosa-si/tests/db-check-foreign-clients.pl index e3ebba80e..95c420c9e 100755 --- a/gosa-si/tests/db-check-foreign-clients.pl +++ b/gosa-si/tests/db-check-foreign-clients.pl @@ -20,27 +20,22 @@ 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"; diff --git a/gosa-si/tests/db-check-incoming.pl b/gosa-si/tests/db-check-incoming.pl index 03a40e12d..014b22c97 100755 --- a/gosa-si/tests/db-check-incoming.pl +++ b/gosa-si/tests/db-check-incoming.pl @@ -20,27 +20,22 @@ 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"; diff --git a/gosa-si/tests/db-check-jobs.pl b/gosa-si/tests/db-check-jobs.pl index b80039b62..5ecbe49a9 100755 --- a/gosa-si/tests/db-check-jobs.pl +++ b/gosa-si/tests/db-check-jobs.pl @@ -20,27 +20,22 @@ 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"; diff --git a/gosa-si/tests/db-check-messaging.pl b/gosa-si/tests/db-check-messaging.pl index f7244ad8c..08e45280a 100755 --- a/gosa-si/tests/db-check-messaging.pl +++ b/gosa-si/tests/db-check-messaging.pl @@ -20,25 +20,22 @@ 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"; diff --git a/gosa-si/tests/db-check-packages-list.pl b/gosa-si/tests/db-check-packages-list.pl index d01644e19..e99c5e068 100755 --- a/gosa-si/tests/db-check-packages-list.pl +++ b/gosa-si/tests/db-check-packages-list.pl @@ -20,27 +20,22 @@ 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"; diff --git a/gosa-si/tests/db-check-server.pl b/gosa-si/tests/db-check-server.pl index 18f59d7b5..f0caeca3e 100755 --- a/gosa-si/tests/db-check-server.pl +++ b/gosa-si/tests/db-check-server.pl @@ -20,26 +20,22 @@ 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"; diff --git a/gosa-si/tests/db-check-users.pl b/gosa-si/tests/db-check-users.pl index 1f49f8cc5..c86be7c31 100755 --- a/gosa-si/tests/db-check-users.pl +++ b/gosa-si/tests/db-check-users.pl @@ -20,29 +20,22 @@ 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";