summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 842fe7e)
raw | patch | inline | side by side (parent: 842fe7e)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 4 Mar 2009 14:06:50 +0000 (14:06 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 4 Mar 2009 14:06:50 +0000 (14:06 +0000) |
changeset:13492
changeset:13493
changeset:13494
changeset:13495
changeset:13496
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13497 594d385d-05f5-0310-b6e9-bd551577e9d8
changeset:13493
changeset:13494
changeset:13495
changeset:13496
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13497 594d385d-05f5-0310-b6e9-bd551577e9d8
index 99bb3506909d66fbcae153ea52daeb6efc0b0bce..7ae02e44dd302cce9f0e2f91827f5822bf0be326 100644 (file)
$nu_clients --;
}
- # number of actual activ clients
+ # number of current active clients
my $act_nu_clients = $nu_clients;
- &main::daemon_log("$session_id INFO: number of actual activ clients: $act_nu_clients", 5);
+ &main::daemon_log("$session_id INFO: number of current active clients: $act_nu_clients", 5);
&main::daemon_log("$session_id INFO: number of maximal allowed clients: $max_clients", 5);
if($max_clients <= $act_nu_clients) {
index 65d2896155e2878c0e0c3b7e01b56f9a68fea991..c9ebc440f562bc4d91405895236e40f4125f6e9c 100644 (file)
# Save full column description for creation of database
push(@col_names_creation, $col_name);
my @t = split(" ", $col_name);
- $col_name = $t[0];
+ my $column_name = $t[0];
# Save column name internally for select_dbentry
- push(@col_names, $col_name);
+ push(@col_names, $column_name);
}
- $col_names->{ $table_name } = $col_names_ref;
+ $col_names->{ $table_name } = \@col_names;
my $col_names_string = join(", ", @col_names_creation);
my $sql_statement = "CREATE TABLE IF NOT EXISTS $table_name ( $col_names_string )";
$self->lock();
sub count_dbentries {
my ($self, $table)= @_;
my $error= 0;
- my $answer= -1;
+ my $count= -1;
- my $sql_statement= "SELECT * FROM $table";
+ my $sql_statement= "SELECT count() FROM $table";
my $db_answer= &select_dbentry($self, $sql_statement);
+ if(defined($db_answer) && defined($db_answer->{1}) && defined($db_answer->{1}->{'count()'})) {
+ $count = $db_answer->{1}->{'count()'};
+ }
- my $count = keys(%{$db_answer});
return $count;
}
my $sql_statement_drop = "DROP TABLE IF EXISTS $to";
my $sql_statement_alter = "ALTER TABLE $from RENAME TO $to";
+ $self->lock();
eval {
$self->{dbh}->do($sql_statement_drop);
};
&main::daemon_log("ERROR: $sql_statement_alter failed with $@", 1);
}
}
+ $self->unlock();
return;
}
index 6870505827e081406b744f3d1cb27a6f5002de92..ac934d53bde4e33c9e5280ccb719eedf0b8d10ae 100644 (file)
return @out_msg_l;
}
-sub count_fai_releas{ return &count_db( @_ ); }
+sub count_fai_release{ return &count_db( @_ ); }
sub count_fai_server{ return &count_db( @_ ); }
sub count_packages_list{ return &count_db( @_ ); }
sub count_jobdb{ return &count_db( @_ ); }
$db = $main::fai_server_db;
} elsif( $header =~ /count_fai_release/ ) {
$table = $main::fai_release_tn;
- $db = $main::fai_server_db;
+ $db = $main::fai_release_db;
}
-
- # prepare sql statement and execute query
- my $res_hash = $db->select_dbentry("SELECT * FROM $table");
-
- my $count = keys(%{$res_hash});
+ my $count = $db->count_dbentries($table);
my $out_xml= "<xml><header>answer</header><source>$target</source><target>$source</target><count>$count</count><session_id>$session_id</session_id></xml>";
my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
if (defined $forward_to_gosa) {
index 73a4e95b6a3986958f09de48f9e4b1995eae05f5..8742aec166f18e1ee7ba6854a05dda85dcde8924 100644 (file)
);
if($ldap_mesg->count == 1) {
$ogroup_entry= $ldap_mesg->pop_entry();
+ &main::daemon_log("$session_id DEBUG: A GosaGroupOfNames with cn '$ogroup' was found in base '".$main::ldap_base."'!", 5);
} elsif ($ldap_mesg->count == 0) {
&main::daemon_log("$session_id ERROR: A GosaGroupOfNames with cn '$ogroup' was not found in base '".$main::ldap_base."'!", 1);
$main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting' WHERE id = $jobdb_id");
return undef;
} else {
&main::daemon_log("$session_id INFO: System with mac address '$mac' was moved to base '".$main::ldap_base."'! Re-queuing job.", 4);
- $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting' WHERE id = $jobdb_id");
- $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET timestamp = '".(&calc_timestamp(&get_time(), 'plus', 10))."' WHERE id = $jobdb_id");
+ $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting', timestamp = '".(&calc_timestamp(&get_time(), 'plus', 10))."' WHERE id = $jobdb_id");
return undef;
}
}
my $oclass_result = $ldap_entry->update($ldap_handle);
if ($oclass_result->code() != 0) {
&main::daemon_log("$session_id ERROR: Adding the ObjectClass '$oclass' failed (code '".$oclass_result->code()."') with '".$oclass_result->{'errorMessage'}."'!", 1);
+ } else {
+ &main::daemon_log("$session_id DEBUG: Adding the ObjectClass '$oclass' to '".($ldap_entry->dn())."' succeeded!", 5);
}
}
}
my $replace_result = $ldap_entry->update($ldap_handle);
if ($replace_result->code() != 0) {
&main::daemon_log("$session_id ERROR: Setting the FAIstate to install failed with code '".$replace_result->code()."') and message '".$replace_result->{'errorMessage'}."'!", 1);
+ } else {
+ &main::daemon_log("$session_id DEBUG: Setting the FAIstate to install for '".($ldap_entry->dn())."' succeeded!", 5);
}
}
} else {
my $add_result = $ldap_entry->update($ldap_handle);
if ($add_result->code() != 0) {
&main::daemon_log("$session_id ERROR: Setting the FAIstate to install failed with code '".$add_result->code()."') and message '".$add_result->{'errorMessage'}."'!", 1);
+ } else {
+ &main::daemon_log("$session_id DEBUG: Setting the FAIstate to install for '".($ldap_entry->dn())."' succeeded!", 5);
}
}
# $ldap_entry = Net::LDAP::Entry->new();
# $ldap_entry->dn("cn=$mac,$base");
&main::daemon_log("$session_id WARNING: No System with mac address '$mac' was found in base '".$main::ldap_base."'! Re-queuing job.", 4);
- $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting' WHERE id = $jobdb_id");
- $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET timestamp = '".(&calc_timestamp(&get_time(), 'plus', 10))."' WHERE id = $jobdb_id");
+ $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting', timestamp = '".(&calc_timestamp(&get_time(), 'plus', 60))."' WHERE id = $jobdb_id");
return undef;
} else {
&main::daemon_log("$session_id ERROR: More than one system with mac address '$mac' was found in base '".$main::ldap_base."'!", 1);
my $ogroup_result = $ogroup_entry->update($ldap_handle);
if ($ogroup_result->code() != 0) {
&main::daemon_log("$session_id ERROR: Updating the ObjectGroup '$ogroup' failed (code '".$ogroup_result->code()."') with '".$ogroup_result->{'errorMessage'}."'!", 1);
+ } else {
+ &main::daemon_log("$session_id DEBUG: Updating the ObjectGroup '$ogroup' for member '".($ldap_entry->dn())."' succeeded!", 5);
}
} else {
&main::daemon_log("$session_id DEBUG: System with mac address '$mac' is already a member of ObjectGroup '$ogroup'.", 5);
if ($activate_result->code() != 0) {
&main::daemon_log("$session_id ERROR: Activating system '".$ldap_entry->dn()."' failed (code '".$activate_result->code()."') with '".$activate_result->{'errorMessage'}."'!", 1);
} else {
+ &main::daemon_log("$session_id DEBUG: Activating system '".$ldap_entry->dn()."' succeeded!", 5);
$activate_client = 1;
}
} else {
if ($activate_result->code() != 0) {
&main::daemon_log("$session_id ERROR: Activating system '".$ldap_entry->dn()."' failed (code '".$activate_result->code()."') with '".$activate_result->{'errorMessage'}."'!", 1);
} else {
+ &main::daemon_log("$session_id DEBUG: Activating system '".$ldap_entry->dn()."' succeeded!", 5);
$activate_client = 1;
}
}
if($activate_client == 1) {
+ &main::daemon_log("$session_id DEBIG: Activating system with mac address '$mac'!", 5);
# Create delivery list
my @out_msg_l;
# Return delivery list of messages
return @out_msg_l;
- } else {
+ } else {
&main::daemon_log("$session_id WARNING: Activating system with mac address '$mac' failed! Re-queuing job.", 4);
- $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting' WHERE id = $jobdb_id");
- $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET timestamp = '".(&calc_timestamp(&get_time(), 'plus', 10))."' WHERE id = $jobdb_id");
+ $main::job_db->exec_statement("UPDATE ".$main::job_queue_tn." SET status = 'waiting', timestamp = '".(&calc_timestamp(&get_time(), 'plus', 60))."' WHERE id = $jobdb_id");
}
return undef;
}