Author: arkurth
Date: Thu Mar 25 13:11:51 2010
New Revision: 927381
URL: http://svn.apache.org/viewvc?rev=927381&view=rev
Log:
VCL-329
Fixed bug in DataStructure.pm get_computer_private_ip_address(). The regex that
locates the line in /etc/hosts for the computer was modified to allow for both
the short hostname and full DNS name in the hosts line. Also added a warning
message to _automethod if an attempt is made to call $self->data->[sub name],
where [sub name] doesn't begin with 'set' or 'get'.
Modified:
incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
Modified: incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
URL:
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm?rev=927381&r1=927380&r2=927381&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm Thu Mar 25
13:11:51 2010
@@ -586,7 +586,8 @@ sub _automethod : Automethod {
$data_identifier = $2;
}
else {
- return;
+ notify($ERRORS{'WARNING'}, 0, "illegal subroutine name:
$method_name");
+ return sub { };
}
# Determines whether or not warnings are shown if data is not
initialized
@@ -1465,8 +1466,8 @@ sub get_computer_private_ip_address {
return;
}
- # Find lines containing the computer name
- my @matching_computer_hosts_lines = grep(/\s$computer_name\s*$/i,
@$output);
+ # Find lines containing the computer name followed by a space or period
+ my @matching_computer_hosts_lines = grep(/\s$computer_name[\s\.]/i,
@$output);
# Extract matching lines which aren't commented out
my @uncommented_computer_hosts_lines = grep(/^\s*[^#]/,
@matching_computer_hosts_lines);