diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index f49977e08cfcbe3956ca87196f758df84af9cc05..255fa3391de4ed93aac794f748b6d230a4378c53 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
# REVISION: ---
#===============================================================================
-my $server_version = '$HeadURL: https://oss.gonicus.de/repositories/gosa/trunk/gosa-si/gosa-si-server $:$Rev$';
-
use strict;
use warnings;
use Getopt::Long;
use Net::LDAP;
use Net::LDAP::Util qw(:escape);
+my $server_version = '$HeadURL: https://oss.gonicus.de/repositories/gosa/trunk/gosa-si/gosa-si-server $:$Rev$';
# revision number of server and program name
my $server_headURL;
@@ -248,7 +247,7 @@ our $check_periodic = {"months"=>'', "weeks"=>'', "days"=>'', "hours"=>'', "minu
"messaging" => [\$messaging_file_name, '/var/lib/gosa-si/messaging.db'],
"foreign-clients" => [\$foreign_clients_file_name, '/var/lib/gosa-si/foreign_clients.db'],
"source-list" => [\$sources_list, '/etc/apt/sources.list'],
- "repo-path" => [\$repo_path, '/srv/www/repository'],
+ "repo-path" => [\$repo_path, '/srv/www'],
"debian-arch" => [\$arch, 'i386'],
"ldap-uri" => [\$ldap_uri, ""],
"ldap-base" => [\$ldap_base, ""],
sub check_pid {
$pid = -1;
# Check, if we are already running
- if( open(LOCK_FILE, "<$pid_file") ) {
- $pid = <LOCK_FILE>;
+ if( open( my $LOCK_FILE, "<", "$pid_file" ) ) {
+ $pid = <$LOCK_FILE>;
if( defined $pid ) {
chomp( $pid );
if( -f "/proc/$pid/stat" ) {
my($stat) = `cat /proc/$pid/stat` =~ m/$pid \((.+)\).*/;
if( $stat ) {
print STDERR "\nERROR: Already running!\n";
- close( LOCK_FILE );
+ close( $LOCK_FILE );
exit -1;
}
}
# create a syslog msg if it is not to possible to open PID file
if (not sysopen(LOCK_FILE, $pid_file, O_WRONLY|O_CREAT|O_EXCL, 0644)) {
my($msg) = "Couldn't obtain lockfile '$pid_file' ";
- if (open(LOCK_FILE, '<', $pid_file)
- && ($pid = <LOCK_FILE>))
+ if (open(my $LOCK_FILE, '<', $pid_file)
+ && ($pid = <$LOCK_FILE>))
{
chomp($pid);
$msg .= "(PID $pid)\n";
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 $fh;
- open($fh, ">$result");
+ open(my $fh, ">", "$result");
if (not defined $fh) {
&main::daemon_log("$session_id DEBUG: cannot open '$result' for writing", 7);
return undef;
my $line;
- open(CONFIG, "<$sources_file") or do {
+ open(my $CONFIG, "<", "$sources_file") or do {
daemon_log( "$session_id ERROR: create_packages_list_db: Failed to open '$sources_file'", 1);
unlink($packages_list_under_construction);
return;
&parse_package_info( $baseurl, $dist, $section, $session_id );
}
}
+ else {
+ daemon_log("$session_id ERROR: cannot parse line '$line'", 1);
+ }
}
- close (CONFIG);
+ close ($CONFIG);
if(keys(%repo_dirs)) {
find(\&cleanup_and_extract, keys( %repo_dirs ));
return;
}
- open($PACKAGES, "<$path.in");
+ open(my $PACKAGES, "<", "$path.in");
if(not defined($PACKAGES)) {
daemon_log("$session_id ERROR: create_packages_list_db: parse_package: cannot open '$path.in'",1);
return;
my $tmpl= ""; {
local $/=undef;
- open FILE, "$dir/DEBIAN/templates";
- $tmpl = &encode_base64(<FILE>);
- close FILE;
+ open(my $FILE, "$dir/DEBIAN/templates");
+ $tmpl = &encode_base64(<$FILE>);
+ close($FILE);
}
rmtree("$dir/DEBIAN/templates");
# Do something useful - put our PID into the pid_file
if( 0 != $pid ) {
- open( LOCK_FILE, ">$pid_file" );
- print LOCK_FILE "$pid\n";
- close( LOCK_FILE );
+ open( my $LOCK_FILE, ">", "$pid_file" );
+ print $LOCK_FILE "$pid\n";
+ close( $LOCK_FILE );
if( !$foreground ) {
exit( 0 )
};
# Prepare log file and set permissions
$root_uid = getpwnam('root');
$adm_gid = getgrnam('adm');
-open(FH, ">>$log_file");
-close FH;
+open(my $FH, ">>", "$log_file");
+close($FH);
chmod(0440, $log_file);
chown($root_uid, $adm_gid, $log_file);
chown($root_uid, $adm_gid, "/var/lib/gosa-si");