summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: daa04b6)
raw | patch | inline | side by side (parent: daa04b6)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 29 May 2008 14:16:43 +0000 (14:16 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 29 May 2008 14:16:43 +0000 (14:16 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11109 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-client | patch | blob | history |
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index f01b310e5d5b4b6bc5755b468efe9c3c2d4276f3..c4a59936190aeb6695299ead8ac54528c25d3e91 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
use lib "/usr/lib/gosa-si/client/events";
my (%cfg_defaults, $foreground, $verbose, $pid_file, $procid, $pid, $log_file, $fai_logpath);
-my ($server_ip, $server_port, $server_key, $server_timeout, $server_domain, $server_key_lifetime);
-my ($client_ip, $client_port, $client_mac_address, $ldap_enabled, $ldap_config, $pam_config, $nss_config);
+my ($server_ip, $server_port, $server_timeout, $server_domain, $server_key_lifetime);
+my ($client_port, $ldap_enabled, $ldap_config, $pam_config, $nss_config);
my $xml;
my $default_server_key;
my $event_hash;
$verbose= 1;
# globalise variables which are used in imported events
+our $global_kernel;
our $cfg_file;
our $opts_file;
our $server_address;
my $socket = &open_socket($address);
if( !$socket ) {
daemon_log("ERROR: cannot send ".$msg_header."msg to $address , host not reachable", 1);
+ $REGISTERED = 0; # if server is not available, cause reregistering
+ #$global_kernel->yield('register_at_gosa_si_server');
$error++;
}
my $events = join( ",", keys %{$event_hash} );
while(1) {
- # fetch first gosa-si-server from @servers
- my $server = shift(@servers);
+ $try_to_register++;
- # append shifted gosa-si-server at the end of @servers, so looking for servers never stop if
- # a registration never occured
- push( @servers, $server );
+ # after one complete round through all server, stop trying to register
+ if( $try_to_register > @servers ) { last; }
+ # fetch first gosa-si-server from @servers
+ # append shifted gosa-si-server at the end of @servers, so looking for servers never stop if
+ # a registration never occured
+ my $server = shift(@servers);
+ push( @servers, $server );
+
+ # Check if our ip is resolvable - if not: don't try to register
if(!(defined($server) && $server =~ m/^[0-9\.]*?:.*$/)) {
&main::daemon_log("ERROR: Server with address '".defined($server)?$server:""."' is invalid!", 1);
if (length(@servers) == 1) {
# send xml hash to server with general server passwd
my $res = &send_msg_hash_to_target($register_hash, $server, $default_server_key);
-
- if( $try_to_register >= @servers ) { last; }
# if delivery of registration msg succeed
- if($res == 0) {
+ if($res eq "0") {
# reset try_to_register
$try_to_register = 0;
# delivery of registration msg failed
} else {
- $try_to_register++;
# wait 1 sec until trying to register again
sleep(1);
next;
}
} # end of while
-
# one circle through all servers finished and no registration succeed
if ( $try_to_register >= @servers ) {
&write_to_file("gosa-si-no-server-available", $fai_logpath);
}
-#sub generic_file_reset {
-# my ( $heap, $wheel_id ) = @_[ HEAP, ARG0 ];
-#
-# my $service = $heap->{services}->{$wheel_id};
-# daemon_log("INFO: '$service' watching reset", 5);
-# return;
-#}
-
sub generic_file_error {
my ( $heap, $operation, $errno, $error_string, $wheel_id ) =
@_[ HEAP, ARG0, ARG1, ARG2, ARG3 ];
sub _start {
my ($kernel, $heap) = @_[KERNEL, HEAP];
$kernel->alias_set('client_session');
+ $global_kernel = $kernel; # this is used to throw events at each point of the skript
# force a registration at a gosa-si-server
$kernel->yield('register_at_gosa_si_server');