Code

bugfix: create_packages_list_db
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 Mar 2008 15:46:10 +0000 (15:46 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 Mar 2008 15:46:10 +0000 (15:46 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9685 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-server
gosa-si/server/events/databases.pm

index 3243918fe93b607ae5621b4d980466d353c0f18e..dfa840aa8ef762125c8045d856e549516d7f3ffd 100755 (executable)
@@ -1890,40 +1890,6 @@ sub apply_fai_inheritance {
        return $fai_classes;
 }
 
-sub get_fai_release_entries {
-       my $tmp_classes = shift || return;
-       my $parent = shift || "";
-       my @result = shift || ();
-
-       foreach my $entry (keys %{$tmp_classes}) {
-               if(defined($entry)) {
-                       if($entry =~ /^ou=.*$/) {
-                               my $release_name = $entry;
-                               $release_name =~ s/ou=//g;
-                               if(length($parent)>0) {
-                                       $release_name = $parent."/".$release_name;
-                               }
-                               my @bufentries = get_fai_release_entries($tmp_classes->{$entry}, $release_name, @result);
-                               foreach my $bufentry(@bufentries) {
-                                       push @result, $bufentry;
-                               }
-                       } else {
-                               my @types = get_fai_types($tmp_classes->{$entry});
-                               foreach my $type (@types) {
-                                       push @result, 
-                                       {
-                                               'class' => $entry,
-                                               'type' => $type->{'type'},
-                                               'release' => $parent,
-                                               'state' => $type->{'state'},
-                                       };
-                               }
-                       }
-               }
-       }
-
-       return @result;
-}
 
 sub deep_copy {
        my $this = shift;
@@ -2043,7 +2009,7 @@ sub parse_package {
     }
 
     open($PACKAGES, "<$path.in");
-       if(defined($PACKAGES)) {
+       if(not defined($PACKAGES)) {
         daemon_log("ERROR: create_packages_list_db: parse_package: can not open '$path.in'",1); 
         return;
     }
index 279ca6e9fca15dd70641d3851e94aafee7553016..c92319ed28b7cefc098e02c848dff89d7ffc6938 100644 (file)
@@ -12,6 +12,8 @@ my @events = (
     "count_packages_list",
     "query_fai_server",
     "count_fai_server",
+    "query_fai_releases",
+    "count_fai_releases",
     );
 @EXPORT = @events;
 
@@ -33,7 +35,7 @@ sub get_events {
     return \@events;
 }
 
-
+sub query_fai_releases{ return &query_db( @_ ); }
 sub query_fai_server{ return &query_db( @_ ) ; }
 sub query_packages_list { return &query_db( @_ ) ; }
 sub query_jobdb { return &query_db( @_ ) ; }
@@ -50,10 +52,14 @@ sub query_db {
     } elsif( $header =~ /query_packages_list/ ) {
         $table = $main::packages_list_tn;
         $db = $main::packages_list_db;
-    }± elsif( $header =~ /query_fai_server/ ) {
+    } elsif( $header =~ /query_fai_server/ ) {
         $table = $main::fai_server_tn;
         $db = $main::fai_server_db
+    } elsif( $header =~ /count_fai_releases/ ) {
+        $table = $main::fai_releases_tn;
+        $db = $main::fai_server_db
     }
+
    
     # prepare sql statement and execute query
     my $select= &get_select_statement($msg, $msg_hash);
@@ -68,6 +74,7 @@ sub query_db {
     return @out_msg_l;
 }
     
+sub count_fai_releases{ return &count_db( @_ ); }    
 sub count_fai_server{ return &count_db( @_ ); }
 sub count_packages_list{ return &count_db( @_ ); }
 sub count_jobdb{ return &count_db( @_ ); }
@@ -79,8 +86,6 @@ sub count_db {
     my $table;
     my $db;
 
-    
-
     if( $header =~ /count_jobdb/ ) {
         $table = $main::job_queue_tn;
         $db = $main::job_db;
@@ -90,8 +95,12 @@ sub count_db {
     } elsif( $header =~ /count_fai_server/ ) {
         $table = $main::fai_server_tn;
         $db = $main::fai_server_db
+    } elsif( $header =~ /count_fai_releases/ ) {
+        $table = $main::fai_releases_tn;
+        $db = $main::fai_server_db
     }
 
+
     # prepare sql statement and execute query
     my $res_hash = $db->select_dbentry("SELECT * FROM $table");