Skip to content
Snippets Groups Projects
Commit ce4e4170 authored by Tomáš Plesník's avatar Tomáš Plesník
Browse files

zmena nazvu funkce getClientInfo; zmena zpusobu nacitani konfiguracniho...

zmena nazvu funkce getClientInfo; zmena zpusobu nacitani konfiguracniho souboru klienta; smazany nadbytecne promenne
parent 75995647
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@ use Carp;
our $VERSION = "2.2";
#-------------------------------------------------------------------------------
# errMsg - prints error msg and returns undef or prints warning and returns 1
#-------------------------------------------------------------------------------
......@@ -127,36 +128,29 @@ sub c2s
}
}
#-------------------------------------------------------------------------------
# getClientsInfo - retrieve information about other clients from Warden server
# getClientInfo - retrieve information about other clients from Warden server
#-------------------------------------------------------------------------------
sub getClientsInfo
sub getClientInfo
{
my $warden_path = shift;
my $etcdir = $warden_path . "/etc/";
my $libdir = $warden_path . "/lib/";
require $libdir . "WardenClientConf.pm";
# read the config file
my $conf_file = $etcdir . "warden-client.conf";
WardenClientConf::loadConf($conf_file);
# c2s() returns undef on fail
my $response = c2s($WardenClientConf::URI, $WardenClientConf::SSL_KEY_FILE, $WardenClientConf::SSL_CERT_FILE, $WardenClientConf::SSL_CA_FILE, "getClientInfo");
# load client configuration
my $lib = File::Basename::dirname(__FILE__);
my $etc = "$lib/../etc";
my $conf_file = "$etc/warden-client.conf";
loadConf($conf_file);
# obtain information about clients on Warden server
my $response = c2s($WardenCommon::URI, $WardenCommon::SSL_KEY, $WardenCommon::SSL_CERT, $WardenCommon::SSL_CA_CERT, "getClientInfo");
defined $response or return; # receive data or return undef
# parse returned SOAP data object with clients
# parse server response (SOAP data object)
my @clients;
my ($client_id, $hostname, $registered, $requestor, $service, $client_type, $type, $receive_own_events, $description_tags, $ip_net_client);
my @response_list = $response->valueof('/Envelope/Body/getClientInfoResponse/client/');
while (scalar @response_list) {
my $response_data = shift(@response_list);
my %client;
$client{'client_id'} = $response_data->{'CLIENT_ID'} ;
$client{'hostname'} = $response_data->{'HOSTNAME'};
$client{'registered'} = $response_data->{'REGISTERED'};
......@@ -167,13 +161,12 @@ sub getClientsInfo
$client{'receive_own_events'} = $response_data->{'RECEIVE_OWN_EVENTS'};
$client{'description_tags'} = $response_data->{'DESCRIPTION_TAGS'};
$client{'ip_net_client'} = $response_data->{'IP_NET_CLIENT'};
# push received clients from warden server into @clients which is returned
push (@clients,\%client);
}
return @clients;
}
} # End of getClientInfo
#-------------------------------------------------------------------------------
# loadConf - load configuration file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment