fix for bug 3219819: do not add hosts into /etc/hosts if the ip field is not an ip

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9625 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
ligc 2011-05-18 01:31:14 +00:00
parent c3fc66defe
commit dceba492cb

View File

@ -225,10 +225,12 @@ sub process_request {
if ($DELNODE) {
delnode $ref->{node},$ref->{ip},$ref->{hostnames},$domain;
} else {
addnode $ref->{node},$ref->{ip},$ref->{hostnames},$domain;
if (defined($ref->{otherinterfaces})){
addotherinterfaces $ref->{node},$ref->{otherinterfaces},$domain;
}
if ( xCAT::Utils->isIpaddr($ref->{ip}) ) {
addnode $ref->{node},$ref->{ip},$ref->{hostnames},$domain;
if (defined($ref->{otherinterfaces})){
addotherinterfaces $ref->{node},$ref->{otherinterfaces},$domain;
}
}
}
} #end foreach
} # end else
@ -238,10 +240,12 @@ sub process_request {
}
my @hostents = $hoststab->getAllNodeAttribs(['ip','node','hostnames','otherinterfaces']);
foreach (@hostents) {
addnode $_->{node},$_->{ip},$_->{hostnames},$domain;
if (defined($_->{otherinterfaces})){
addotherinterfaces $_->{node},$_->{otherinterfaces},$domain;
}
if ( xCAT::Utils->isIpaddr($_->{ip}) ) {
addnode $_->{node},$_->{ip},$_->{hostnames},$domain;
if (defined($_->{otherinterfaces})){
addotherinterfaces $_->{node},$_->{otherinterfaces},$domain;
}
}
}
}
writeout();