diff --git a/src/warden-client/lib/WardenClientCommon.pm b/src/warden-client/lib/WardenClientCommon.pm index 24e3c529027e0fb5f4c91448a206b453d0179264..6b6f5f6a0b2fc0fa6a7c0fdad5449417309bcccd 100755 --- a/src/warden-client/lib/WardenClientCommon.pm +++ b/src/warden-client/lib/WardenClientCommon.pm @@ -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