From d987b028d7c1d6695c655421227a2d038144bd0e Mon Sep 17 00:00:00 2001 From: rettenbe Date: Thu, 21 Feb 2008 10:24:53 +0000 Subject: [PATCH] ip in config file accepts plan names like 'localhost' git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9009 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-client | 10 ++++++++++ gosa-si/gosa-si-server | 7 ++----- gosa-si/modules/GosaPackages.pm | 10 ++++++++-- gosa-si/modules/SIPackages.pm | 11 +++++++++++ 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client index fee7b7199..0c962c8ea 100755 --- a/gosa-si/gosa-si-client +++ b/gosa-si/gosa-si-client @@ -1333,6 +1333,11 @@ daemon_log("$prg started!", 1); system('rm -f /tmp/gosa_si_lock*gosa-si-client*'); # detect ip and mac address and complete host address +#if( inet_aton($client_ip) ){ +#print STDERR "ip: $client_ip\n"; +# $client_ip = inet_ntoa(inet_aton($client_ip)); +#print STDERR "ip: $client_ip\n"; +#} $client_address = $client_ip.":".$client_port; my $network_interface= &get_interface_for_ip($client_ip); $client_mac_address= &get_mac($network_interface); @@ -1359,6 +1364,11 @@ daemon_log("start socket for incoming xml messages at port '$client_port' ", 1); # prepare variables +if( inet_aton($server_ip) ){ $server_ip = inet_ntoa(inet_aton($server_ip)); } +############################################################ +# to change +if( $server_ip eq "127.0.1.1" ) { $server_ip = "127.0.0.1" } +############################################################ if (defined $server_ip && defined $server_port) { $server_address = $server_ip.":".$server_port; } diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index c445ad4c7..4ea7bdbab 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -107,7 +107,7 @@ our $prg= basename($0); "activ" => [\$bus_activ, "true"], }, "server" => { -# "ip" => [\$server_ip, "0.0.0.0"], +# "ip" => [\$server_ip, "0.0.0.0"], "port" => [\$server_port, "20081"], "known-clients" => [\$known_clients_file_name, '/var/lib/gosa-si/clients.db' ], "known-servers" => [\$known_server_file_name, '/var/lib/gosa-si/servers.db'], @@ -519,7 +519,7 @@ sub input_from_known_client { while( my ($hit_num, $hit) = each %{ $query_res } ) { my $host_name = $hit->{hostname}; if( not $host_name =~ /^$remote_ip:\d*$/) { - next; + next; } my $host_key = $hit->{hostkey}; &daemon_log("SIPackages: known_client host_name: $host_name", 7); @@ -1089,9 +1089,6 @@ sub watch_for_new_jobs { # add sqlite_id $job_msg =~ s/<\/xml>$/$jobdb_id<\/jobdb_id><\/xml>/; - -print STDERR "=======================================================\n$job_msg\n"; - &send_msg_to_target($job_msg, $server_address, $GosaPackages_key, $header); # my $error = 1; diff --git a/gosa-si/modules/GosaPackages.pm b/gosa-si/modules/GosaPackages.pm index 8314850c7..7e5eb63f5 100644 --- a/gosa-si/modules/GosaPackages.pm +++ b/gosa-si/modules/GosaPackages.pm @@ -7,6 +7,7 @@ use strict; use warnings; use GOSA::GosaSupportDaemon; use IO::Socket::INET; +use Socket; use XML::Simple; use File::Spec; use Data::Dumper; @@ -50,7 +51,9 @@ $network_interface= &get_interface_for_ip($server_ip); $gosa_mac_address= &get_mac($network_interface); # complete addresses +if( inet_aton($server_ip) ){ $server_ip = inet_ntoa(inet_aton($server_ip)); } our $server_address = "$server_ip:$server_port"; +if( inet_aton($gosa_ip) ){ $gosa_ip = inet_ntoa(inet_aton($gosa_ip)); } my $gosa_address = "$gosa_ip:$gosa_port"; # create general settings for this module @@ -277,7 +280,7 @@ sub process_incoming_msg { if (defined ($out_msg) && $out_msg =~ /(\d+)<\/jobdb_id>/) { my $job_id = $1; my $sql = "UPDATE '".$main::job_queue_table_name."'". - " SET status='done'". + " SET status='processing'". " WHERE id='$job_id'"; my $res = $main::job_db->exec_statement($sql); } @@ -525,8 +528,11 @@ sub update_status_jobdb_entry { my $where= &get_where_statement($msg, $msg_hash); my $update= &get_update_statement($msg, $msg_hash); - my $sql_statement = "UPDATE $table $update $where"; + # conditions + # no timestamp update if status eq waiting + + my $sql_statement = "UPDATE $table $update $where"; # execute db query my $db_res = $main::job_db->update_dbentry($sql_statement); diff --git a/gosa-si/modules/SIPackages.pm b/gosa-si/modules/SIPackages.pm index 4dcc734ac..d78915395 100644 --- a/gosa-si/modules/SIPackages.pm +++ b/gosa-si/modules/SIPackages.pm @@ -59,6 +59,9 @@ my %cfg_defaults = ( # read configfile and import variables &read_configfile(); + +# if server_ip is not an ip address but a name +if( inet_aton($server_ip) ){ $server_ip = inet_ntoa(inet_aton($server_ip)); } $network_interface= &get_interface_for_ip($server_ip); $server_mac_address= &get_mac($network_interface); @@ -137,8 +140,16 @@ if((not defined($main::gosa_unit_tag)) || length($main::gosa_unit_tag) == 0) { #if( $server_ip eq "0.0.0.0" ) { # $server_ip = "127.0.0.1"; #} + my $server_address = "$server_ip:$server_port"; $main::server_address = $server_address; + + +if( inet_aton($bus_ip) ){ $bus_ip = inet_ntoa(inet_aton($bus_ip)); } +###################################################### +# to change +if( $bus_ip eq "127.0.1.1" ) { $bus_ip = "127.0.0.1" } +###################################################### my $bus_address = "$bus_ip:$bus_port"; $main::bus_address = $bus_address; -- 2.30.2