From 23b516e289c0e07440d345de49184bf42ffba0f7 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 4 Jun 2009 19:11:04 +0000 Subject: [PATCH] vim git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3515 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/hosts.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index 9b5905db1..5981ab255 100644 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -32,14 +32,18 @@ sub addnode { my $foundone=0; while ($idx <= $#hosts) { - if ($hosts[$idx] =~ /^${ip}\s/ or $hosts[$idx] =~ /^\d+\.\d+\.\d+\.\d+\s+${node}\s/) { + if ($hosts[$idx] =~ /^${ip}\s/ or $hosts[$idx] =~ /^\d+\.\d+\.\d+\.\d+\s+${node}[\s\.r/) { #TODO: if foundone, delete a dupe - $hosts[$idx]=build_line($ip, $node, $domain, $othernames); + if ($foundone) { + $hosts[$idx]=""; + } else { + $hosts[$idx]=build_line($ip, $node, $domain, $othernames); + } $foundone=1; - return; } $idx++; } + if ($foundone) { return;} my $line=build_line($ip, $node, $domain, $othernames); push @hosts, $line;