From 93e6b3cf3464d21c4a81f41dc1ca3ab2b7cf5bfe Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 7 Jan 2010 19:33:58 +0000 Subject: [PATCH] -Support putting hostnames field before nodename and such if -h//--hostnamesfirst is given to makehosts git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4910 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/hosts.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index 7b5eeab88..a9403219b 100644 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -10,6 +10,7 @@ use Getopt::Long; my @hosts; #Hold /etc/hosts data to be written back my $LONGNAME; +my $OTHERNAMESFIRST; my %usage=( @@ -79,6 +80,7 @@ sub build_line { $othernames=join(' ', @o_names); if ($LONGNAME) { return "$ip $longname $node $othernames\n"; } + elsif ($OTHERNAMESFIRST) { return "$ip $othernames $node $longname\n"; } else { return "$ip $node $longname $othernames\n"; } } @@ -116,6 +118,7 @@ sub process_request { if(!GetOptions( 'h|help' => \$HELP, 'n' => \$REMOVE, + 'h|hostnamesfirst' => \$OTHERNAMESFIRST, 'l|longnamefirst' => \$LONGNAME,)) { $callback->({data=>$usage{makehosts}});