summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6c482c0)
raw | patch | inline | side by side (parent: 6c482c0)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Mar 2008 10:17:11 +0000 (10:17 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Mar 2008 10:17:11 +0000 (10:17 +0000) |
Add FAIstate to db.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9426 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9426 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-server | patch | blob | history |
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index 2e43b6fc3375dd2f6458590b7c62e8f6186519aa..2251e9f7a00f314a7c12535d9567ca981ee13660 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
my $fai_server_file_name;
our @fai_server_col_names = ('timestamp', 'server', 'release', 'tag');
our $fai_release_tn = "fai_release";
-our @fai_release_col_names = ('timestamp', 'release', 'class', 'type');
+our @fai_release_col_names = ('timestamp', 'release', 'class', 'type', 'state');
# holds all packages available from different repositories
our $packages_list_db;
if($mesg->{'resultCode'} == 0 &&
$mesg->count != 0) {
# Walk through all possible FAI container ou's
+ my @sql_list;
foreach my $ou (@{$mesg->{entries}}) {
my $tmp_classes= resolve_fai_classes($ou->dn);
if(defined($tmp_classes)) {
if(@tmp_array) {
foreach my $entry (@tmp_array) {
if(defined($entry) && ref($entry) eq 'HASH') {
- $fai_server_db->add_dbentry( {
- table => $table_name,
- primkey => ['release', 'class', 'type'],
- release => $entry->{'release'},
- class => $entry->{'class'},
- type => $entry->{'type'}
- } );
+ my $timestamp= &get_time();
+ my $sql=
+ "INSERT INTO $table_name "
+ ."(timestamp, release, class, type, state) VALUES ("
+ .$timestamp.","
+ ."'".$entry->{'release'}."',"
+ ."'".$entry->{'class'}."',"
+ ."'".$entry->{'type'}."',"
+ ."'".$entry->{'state'}."')";
+ push @sql_list, $sql;
}
}
}
}
}
+ $fai_server_db->exec_statementlist(\@sql_list);
}
daemon_log("Done with creating fai_release_db",4);
}
}
} else {
my $types = get_fai_types($tmp_classes->{$entry});
+ my $state = get_fai_state($tmp_classes->{$entry});
push @result,
{
'class' => $entry,
'type' => $types,
'release' => $parent,
+ 'state' => $state,
};
}
}
return $result;
}
+sub get_fai_state {
+ my $result = "";
+ my $tmp_classes = shift || return $result;
+
+ foreach my $type(keys %{$tmp_classes}) {
+ if(defined($tmp_classes->{$type}[0])) {
+ $result = $tmp_classes->{$type}[0];
+
+ # State is equal for all types in class
+ last;
+ }
+ }
+
+ return $result;
+}
+
sub resolve_fai_classes {
my $result;
my $fai_base= shift;