diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index 3cb1c23ac8791117eb7986ff1a2b779faacf18c6..f1e33172f6f830ac16bc535e8481f4d85a9030d2 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
use XML::Simple;
use Data::Dumper;
use Sys::Syslog qw( :DEFAULT setlogsock);
-use Time::HiRes qw( usleep);
+use Time::HiRes qw( usleep clock_gettime );
use Cwd;
use File::Spec;
use File::Basename;
use Net::LDAP;
use Net::LDAP::Util qw(:escape);
+
# revision number of server and program name
my $server_headURL;
my $server_revision;
no strict "refs";
require ("GOSA/".$db_module.".pm");
("GOSA/".$db_module)->import;
-daemon_log("0 INFO: importing database module '$db_module'", 1);
}
my $modules_path = "/usr/lib/gosa-si/modules";
'vvvvvvv': debug plus info logs
-no-arp : starts $prg without connection to arp module
-d <int> : if verbose level is higher than 7x 'v' specified parts can be debugged
- 1 : receiving messages
- 2 : sending messages
- 4 : encrypting/decrypting messages
- 8 : verification if a message complies gosa-si requirements
+ 1 : report incoming messages
+ 2 : report unencrypted outgoing messages
+ 4 : report encrypting key for messages
+ 8 : report decrypted incoming message and verification if the message complies gosa-si requirements
16 : message processing
32 : ldap connectivity
64 : database status and connectivity
$monthday = $monthday < 10 ? $monthday = "0".$monthday : $monthday;
$year+=1900;
-
+ # Microseconds since epoch
+ my $microSeconds = sprintf("%.2f", &Time::HiRes::clock_gettime());
+ $microSeconds =~ s/^\d*(.\d\d)$/$1/;
+
# Build log message and write it to log file and commandline
chomp($msg);
- my $log_msg = "$month $monthday $hours:$minutes:$seconds $prg $msg\n";
+ my $log_msg = "$month $monthday $hours:$minutes:$seconds$microSeconds $prg $msg\n";
flock(LOG_HANDLE, LOCK_EX);
seek(LOG_HANDLE, 0, 2);
print LOG_HANDLE $log_msg;
module=>$module,
sessionid=>$session_id,
} );
-
+ $kernel->yield('watch_for_next_tasks');
}
# target is own address with forward_to_gosa-tag pointing at myself -> forward to gosa
sessionid=>$session_id,
} );
$done = 1;
+ $kernel->yield('watch_for_next_tasks');
}
while ($answer_str =~ /<header>(\w+)<\/header>/g) {
push(@headers, $1);
}
- daemon_log("$session_id INFO: got answer message(s) with header: '".join("', '", @headers)."'", 5);
- daemon_log("$session_id DEBUG: $module: got answer from module: \n".$answer_str,26);
+ daemon_log("$session_id DEBUG: got answer message(s) with header: '".join("', '", @headers)."'", 26);
} else {
daemon_log("$session_id DEBUG: $module: got no answer from module!" ,26);
}
if( defined $session_id ) {
$add_on = ".session_id=$session_id";
}
+ my $header = ($1) if $answer =~ /<header>(\S*)<\/header>/;
+ daemon_log("$session_id INFO: send ".$header." message to GOsa", 5);
+ daemon_log("$session_id DEBUG: message:\n$answer", 12);
# answer is for GOSA and has to returned to connected client
my $gosa_answer = &encrypt_msg($answer, $GosaPackages_key);
$client_answer = $gosa_answer.$add_on;
$kernel->yield('register_at_foreign_servers');
$kernel->yield('create_fai_server_db', $fai_server_tn );
$kernel->yield('create_fai_release_db', $fai_release_tn );
- $kernel->yield('watch_for_next_tasks');
$kernel->sig(USR1 => "sig_handler");
$kernel->sig(USR2 => "recreate_packages_db");
$kernel->delay_set('watch_for_new_jobs', $job_queue_loop_delay);
sub watch_for_opsi_jobs {
my ($kernel) = $_[KERNEL];
-
# This is not very nice to look for opsi install jobs, but headertag has to be trigger_action_reinstall. The only way to identify a
# opsi install job is to parse the xml message. There is still the correct header.
my $sql_statement = "SELECT * FROM ".$job_queue_tn." WHERE ((xmlmessage LIKE '%opsi_install_client</header>%') AND (status='processing') AND (siserver='localhost'))";
};
my $hres = $opsi_client->call($opsi_url, $callobj);
- #my ($hres_err, $hres_err_string) = &check_opsi_res($hres);
+ # TODO : move all opsi relevant statments to opsi plugin
+ # The following 3 lines must be tested befor they can replace the rubbish above and below !!!
+ #my ($res, $err) = &opsi_com::_getProductStates_hash(hostId=>$hostId)
+ #if (not $err) {
+ # my $htmp = $res->{$hostId};
+ #
if (not &check_opsi_res($hres)) {
my $htmp= $hres->result->{$hostId};
-
# Check state != not_installed or action == setup -> load and add
my $products= 0;
my $installed= 0;
my $sql = "DELETE FROM $incoming_tn WHERE id=$message_id";
my $res = $incoming_db->exec_statement($sql);
}
-
- $kernel->delay_set('watch_for_next_tasks', 1);
}
no strict "refs";
if ($db_module eq "DBmysql") {
+
+ daemon_log("0 INFO: importing database module '$db_module'", 1);
+
# connect to incoming_db
$incoming_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password);
$messaging_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password);
} elsif ($db_module eq "DBsqlite") {
+
+ daemon_log("0 INFO: importing database module '$db_module'", 1);
+
# connect to incoming_db
unlink($incoming_file_name);
$incoming_db = GOSA::DBsqlite->new($incoming_file_name);
}
# Creating tables
+
+daemon_log("0 INFO: creating tables in database with '$db_module'", 1);
+
$messaging_db->create_table($messaging_tn, \@messaging_col_names);
$packages_list_db->create_table($packages_list_tn, \@packages_list_col_names);
$fai_release_db->create_table($fai_release_tn, \@fai_release_col_names);
},
InlineStates => {
msg_to_decrypt => \&msg_to_decrypt,
+ watch_for_next_tasks => \&watch_for_next_tasks,
next_task => \&next_task,
task_result => \&handle_task_result,
task_done => \&handle_task_done,
task_result => \&handle_task_result,
task_done => \&handle_task_done,
task_debug => \&handle_task_debug,
- watch_for_next_tasks => \&watch_for_next_tasks,
watch_for_new_messages => \&watch_for_new_messages,
watch_for_delivery_messages => \&watch_for_delivery_messages,
watch_for_done_messages => \&watch_for_done_messages,