You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by ar...@apache.org on 2009/01/06 00:08:05 UTC
svn commit: r731762 - /incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
Author: arkurth
Date: Mon Jan 5 15:08:05 2009
New Revision: 731762
URL: http://svn.apache.org/viewvc?rev=731762&view=rev
Log:
Updated getdynamicaddress in utils.pm. It did not work with Vista because the 'netsh diag' command is not supported. I added an additional section which uses ipconfig. This functionality will eventually be moved to the various OS modules.
Modified:
incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=731762&r1=731761&r2=731762&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Mon Jan 5 15:08:05 2009
@@ -1647,7 +1647,28 @@
my $identity;
my $dynaIPaddress = 0;
- if ($osname =~ /win|vmwarewin/) {
+ if ($osname =~ /vista/) {
+ $identity = $IDENTITY_wxp;
+
+ @sshcmd = run_ssh_command($node, $identity, "ipconfig", "root");
+ for my $l (@{$sshcmd[1]}) {
+ # skip class a,b,c private addresses
+ next if ($l !~ /IP.*Address[\s\.:]*([\d\.]*)/);
+ my $ip_address = $1;
+ next if ($ip_address =~ /^10\./);
+ next if ($ip_address =~ /^127\./);
+ next if ($ip_address =~ /^172\./);
+ next if ($ip_address =~ /^192\./);
+
+ if ($l !~ /IPAddress = $privateIP/) {
+ #to cover sites using eth0 as public
+ $dynaIPaddress = $1;
+ }
+
+ }
+
+ } ## end if ($osname =~ /win|vmwarewin/)
+ elsif ($osname =~ /win|vmwarewin/) {
$identity = $IDENTITY_wxp;
@sshcmd = run_ssh_command($node, $identity, "netsh diag show ip", "root");
@@ -1691,6 +1712,8 @@
notify($ERRORS{'WARNING'}, 0, "OSname $osname not supported ");
return 0;
}
+
+ notify($ERRORS{'OK'}, 0, "dynamic IP address for $node collected: $dynaIPaddress");
return $dynaIPaddress;
} ## end sub getdynamicaddress