summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d2a161f)
raw | patch | inline | side by side (parent: d2a161f)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 27 Oct 2009 15:02:13 +0000 (15:02 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 27 Oct 2009 15:02:13 +0000 (15:02 +0000) |
* add microseconds to daemon log timestamp
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14661 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14661 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/client/events/corefunctions.pm | patch | blob | history | |
gosa-si/gosa-si-client | patch | blob | history | |
gosa-si/tests/client.php | patch | blob | history |
index 8c599849fdbe7c91c29c8f8478b61a4cb4a248c6..1b387e5fea97281c591a65afd510c36d49c30f84 100644 (file)
$main::client_address = $target;
# set registration_flag to true
- $main::REGISTERED = 1;
+ &main::_setREGISTERED(1);
# Write the MAC address to file
if(stat($main::opts_file)) {
sub new_key {
-
# Create new key
my $new_server_key = &main::create_passwd();
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index e8d37fe34225ed12c2b6803742eedfd1cad81fb3..613aedb112dbc3e4eea24f17f410600d7697cf78 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
our $terminal_server_hash;
# default variables
-our $REGISTERED = 0;
+my $REGISTERED = 0;
# path to fifo for non-gosa-si-client messages to gosa-si-server
my $fai_com_fifo = "/var/run/gosa-si-client.socket";
$monthday = $monthday < 10 ? $monthday = "0".$monthday : $monthday;
$year+=1900;
- my $log_msg = "$month $monthday $hours:$minutes:$seconds $prg $msg\n";
+ # Microseconds since epoch
+ my $microSeconds = sprintf("%.2f", &Time::HiRes::clock_gettime());
+ $microSeconds =~ s/^\d*(.\d\d)$/$1/;
+
+
+ my $log_msg = "$month $monthday $hours:$minutes:$seconds$microSeconds $prg $msg\n";
print LOG_HANDLE $log_msg;
if( $foreground ) {
print STDERR $log_msg;
return $error;
}
+sub _setREGISTERED {
+ my $newStatus = shift;
+ &daemon_log("DEBUG: set REGISTERED flag from '$REGISTERED' to '$newStatus'", 7);
+ $REGISTERED = $newStatus;
+ return;
+}
sub send_msg_to_target {
my ($msg, $address, $encrypt_key, $msg_header) = @_ ;
if( !$socket ) {
daemon_log("WARNING: cannot send ".$msg_header."msg to '$address', host not reachable", 3);
if ($REGISTERED == 1) {
- $REGISTERED = 0; # if server is not available, cause reregistering
+ &_setREGISTERED(0); # if server is not available, cause reregistering
daemon_log("INFO: cause reregistering at gosa-si-server", 5);
$global_kernel->yield('register_at_gosa_si_server');
if($server_address =~ /$remote_ip/) {
# Got a msg from gosa-si-server which can not be decrypted, the secrete is not up-to-date
# cause a reregistering with a new secrete handshake
- daemon_log("ERROR: Message from gosa-si-server could not be understood, cause reregistering at server", 1);
- daemon_log("INFO: Set status of si-client to unregistered and throw new registering event", 5);
- $REGISTERED = 0;
- $kernel->post('client_session', 'register_at_gosa_si_server');
+ daemon_log("ERROR: Message from gosa-si-server could not be understood, cause reregistering at server", 1);
+ if ($REGISTERED) {
+ daemon_log("INFO: Client has currently status registered so throw new registering event", 5);
+ &_setREGISTERED(0);
+ $kernel->post('client_session', 'register_at_gosa_si_server');
+ } else {
+ daemon_log("INFO: Client is currently within a registration process so wait for the next registration itteration", 5);
+ }
}
$error++;
}
index c9907e3b7c897d809d43f915804cc5024084d1c5..c9fde5ffd69d4df0cff694f9f6ee93f258972a89 100755 (executable)
--- a/gosa-si/tests/client.php
+++ b/gosa-si/tests/client.php
#$data = "<xml><header>gosa_opsi_getSoftwareLicenseUsages</header><source>GOSA</source><target>00:01:6C:9D:B9:FA</target><hostId>krakenarme.intranet.gonicus.de</hostId></xml>";
#$data = "<xml><header>gosa_opsi_getSoftwareLicenseUsages</header><source>GOSA</source><target>00:01:6C:9D:B9:FA</target><licensePoolId>LicensePool</licensePoolId></xml>";
#$data = "<xml><header>gosa_opsi_getSoftwareLicenseUsages</header><source>GOSA</source><target>00:01:6C:9D:B9:FA</target></xml>";
- $data = "<xml><header>gosa_opsi_getSoftwareLicenseUsagesForProductId</header><source>GOSA</source><target>00:01:6C:9D:B9:FA</target><productId>firefox</productId></xml>";
+ #$data = "<xml><header>gosa_opsi_getSoftwareLicenseUsagesForProductId</header><source>GOSA</source><target>00:01:6C:9D:B9:FA</target><productId>firefox</productId></xml>";
#$data = "<xml><header>gosa_opsi_getSoftwareLicense_hash</header><source>GOSA</source><target>00:01:6C:9D:B9:FA</target><softwareLicenseId>l_2009-09-22_09:50:58_0</softwareLicenseId></xml>";
# trigger jobs at client
#$data = "<xml> <header>gosa_trigger_goto_settings_reload</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
#$data = "<xml> <header>gosa_detect_hardware</header> <target>00:0C:29:4C:4B:0C</target> <source>GOSA</source> </xml>";
- #$data = "<xml> <header>gosa_new_key_for_client</header> <target>00:0C:29:4C:4B:0C</target> <source>GOSA</source> </xml>";
+ $data = "<xml> <header>gosa_new_key_for_client</header> <target>$mac</target> <source>GOSA</source> <macaddress>$mac</macaddress></xml>";
#$data = "<xml> <header>gosa_trigger_action_wake</header> <target>00:0C:29:4C:4B:0C</target> <source>GOSA</source></xml>";
#$data = "<xml> <header>gosa_trigger_action_faireboot</header> <target>00:0C:29:4C:4B:0C</target> <source>GOSA</source> </xml>";
#$data = "<xml> <header>gosa_trigger_action_reboot</header> <target>00:0C:29:4C:4B:0C</target> <source>GOSA</source> </xml>";