Fix a bug where the node found in /etc/hosts could contain the same pattern and give the incorrect return.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6964 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2010-08-03 19:15:43 +00:00
parent 12f3cb32f0
commit 7db2962e5b

View File

@ -2843,7 +2843,7 @@ sub nodeSet {
my $tmpl = "$profile.$osBase.$arch.tmpl";
# Get host IP and hostname from /etc/hosts
$out = `cat /etc/hosts | grep $node`;
$out = `cat /etc/hosts | grep "$node "`;
my @words = split( ' ', $out );
my $hostIP = $words[0];
my $hostname = $words[2];
@ -2975,7 +2975,7 @@ sub nodeSet {
xCAT::zvmUtils->printLn( $callback, "$node: (Error) Node does not belong to any network in the networks table" );
return;
}
@propNames = ( 'mask', 'gateway', 'tftpserver', 'nameservers' );
$propVals = xCAT::zvmUtils->getTabPropsByKey( 'networks', 'net', $network, @propNames );
my $mask = $propVals->{'mask'};
@ -2988,7 +2988,7 @@ sub nodeSet {
xCAT::zvmUtils->printLn( $callback, "$node: (Error) Missing network information" );
return;
}
# Get broadcast address of NIC
my $ifcfg = xCAT::zvmUtils->getIfcfgByNic( $hcp, $readChannel );
$out = `ssh $hcp "cat $ifcfg" | grep "BROADCAST"`;