From 8219fcf64af18beece9e609e0080285c9f91643b Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 11 Jan 2010 19:06:16 +0000 Subject: [PATCH] -Fix implementation of '-a' on hostnames git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4933 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/hosts.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index f3c8964cb..2f6d79a24 100644 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -56,6 +56,7 @@ sub build_line { my $domain=shift; my $othernames=shift; my @o_names=(); + my @n_names=(); if (defined $othernames) { @o_names=split(/,| /, $othernames); } @@ -70,9 +71,10 @@ sub build_line { $_=""; } } elsif ($ADDNAMES) { - $$othernames = $_.$domain." ".$othernames; + unshift(@n_names,"$_.$domain"); } } + unshift(@o_names,@n_names); if ($node =~ m/\.$domain$/i) { $longname = $node; @@ -83,7 +85,7 @@ sub build_line { $othernames=join(' ', @o_names); if ($LONGNAME) { return "$ip $longname $node $othernames\n"; } - elsif ($OTHERNAMESFIRST) { return "$ip $othernames $node $longname\n"; } + elsif ($OTHERNAMESFIRST) { return "$ip $othernames $longname $node\n"; } else { return "$ip $node $longname $othernames\n"; } }