summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4fec714)
raw | patch | inline | side by side (parent: 4fec714)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 5 Mar 2008 10:28:23 +0000 (10:28 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 5 Mar 2008 10:28:23 +0000 (10:28 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9340 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-server | patch | blob | history | |
gosa-si/tests/sqlite-check-server.pl | patch | blob | history |
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index 86678654b3ee31e18ce2040859bc5f357c3ae732..6aa63e244e4f862d33b1b216a0fb085cc2715c89 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
my @login_users_col_names = ('client', 'user', 'timestamp');
# holds all fai server, the debian release and tag
+my $fai_server_file_name;
our $fai_server_db;
our $fai_server_tn = "fai_server";
-my $fai_server_file_name;
our @fai_server_col_names = ('timestamp', 'server', 'release', 'tag');
+our $fai_release_db;
+our $fai_release_tn = "fai_release";
+our @fai_release_col_names = ('timestamp', 'release', 'class');
# holds all packages available from different repositories
our $packages_list_db;
sub _start {
my ($kernel) = $_[KERNEL];
&trigger_db_loop($kernel);
- #$kernel->yield('create_fai_server_db', $fai_server_tn );
+ $kernel->yield('create_fai_server_db', $fai_server_tn );
+ $kernel->yield('create_fai_release_db', $fai_release_tn );
#$kernel->yield('create_packages_list_db', $sources_list );
}
sub create_fai_server_db {
my ($table_name) = $_[ARG0];
-
-#####################################################################
-#
-# TODO für dich Cajus :-)
-#
-# ###################################################################
-
- $fai_server_db->add_dbentry( {
- table => $table_name,
- primkey => [],
- server => "dummyserver", # neuer fai-server
- release => "kleinkind", # neuer release
- tag => "imwachstum", # neues tag
- } );
- return;
+ my $result;
+
+ if(defined($ldap_handle)) {
+ my $mesg= $ldap_handle->search(
+ base => $main::ldap_base,
+ scope => 'sub',
+ attrs => ['FAIrepository', 'gosaUnitTag'],
+ filter => "(&(FAIrepository=*)(objectClass=FAIrepositoryServer))",
+ );
+ if($mesg->{'resultCode'} == 0 &&
+ $mesg->count != 0) {
+ foreach my $entry (@{$mesg->{entries}}) {
+ if($entry->exists('FAIrepository')) {
+ # Add an entry for each Repository configured for server
+ foreach my $repo(@{$entry->get_value('FAIrepository', asref => 1)}) {
+ my($tmp_url,$tmp_server,$tmp_release,$tmp_sections) = split(/\|/, $repo);
+ my $tmp_tag= $entry->get_value('gosaUnitTag') || "";
+ $result= $fai_server_db->add_dbentry( {
+ table => $table_name,
+ primkey => ['server', 'release', 'tag'],
+ server => $tmp_url,
+ release => $tmp_release,
+ tag => (length($tmp_tag)>0)?$tmp_tag:"",
+ } );
+ }
+ }
+ }
+ }
+ }
+
+ return $result;
+}
+
+
+sub create_fai_release_db {
+ my ($table_name) = $_[ARG0];
+ my $result;
+
+ if(defined($ldap_handle)) {
+ my $mesg= $ldap_handle->search(
+ base => $main::ldap_base,
+ scope => 'sub',
+ attrs => ['cn', 'FAIdebianRelease'],
+ filter => "(&(FAIdebianRelease=*)(objectClass=FAIclass))",
+ );
+ if($mesg->{'resultCode'} == 0 &&
+ $mesg->count != 0) {
+ foreach my $entry (@{$mesg->{entries}}) {
+ if($entry->exists('FAIdebianRelease') && $entry->exists('cn')) {
+ $result= $fai_server_db->add_dbentry( {
+ table => $table_name,
+ primkey => ['release', 'class'],
+ release => $entry->get_value('FAIdebianRelease'),
+ class => $entry->get_value('cn'),
+ } );
+ }
+ }
+ }
+ }
+
+ return $result;
}
$login_users_db = GOSA::DBsqlite->new($login_users_file_name);
$login_users_db->create_table($login_users_tn, \@login_users_col_names);
-# connect to fai_server_db
+# connect to fai_server_db and fai_release_db
$fai_server_db = GOSA::DBsqlite->new($fai_server_file_name);
$fai_server_db->create_table($fai_server_tn, \@fai_server_col_names);
+$fai_server_db->create_table($fai_release_tn, \@fai_release_col_names);
# connect to packages_list_db
unlink($packages_list_file_name);
watch_for_done_jobs => \&watch_for_done_jobs,
create_packages_list_db => \&create_packages_list_db,
create_fai_server_db => \&create_fai_server_db,
+ create_fai_release_db => \&create_fai_release_db,
}
);
index bd0115e1bcdf69fcbf1881bb9cf1fa08728f86b0..5b153316728fc1b2dd040fb99d8efa76c188769e 100755 (executable)
print $answer."\n";
}
+$db_name = "/var/lib/gosa-si/fai.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";
+}
print "\nFINISH\n";