From 62636a02165a1d18f83e19422ed494999838f034 Mon Sep 17 00:00:00 2001 From: jjhua Date: Fri, 26 Oct 2012 08:38:04 +0000 Subject: [PATCH] pre-create mypostscript enhancement. Use the networks info which is got form networks table ahead of time git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14138 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Postage.pm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index 8b8707aac..5d3986e9c 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -147,7 +147,7 @@ sub makescript #create the mypostscript for each node once according to the template if(ref($node) eq "ARRAY") { - require xCAT::Template; + require xCAT::Template; xCAT::Template->subvars_for_mypostscript($node, $nodesetstate, $callback); return; } @@ -184,7 +184,7 @@ sub makescript # for them in the post install file my $attribute; my $value; - my $masterset = 0; + my $masterset = 0; foreach (keys(%::XCATSITEVALS)) # export the attribute { $attribute = $_; @@ -958,16 +958,21 @@ sub getnodesetstate sub net_parms { my $ip = shift; + my $nets = shift; $ip = xCAT::NetworkUtils->getipaddr($ip); if (!$ip) { xCAT::MsgUtils->message("S", "Unable to resolve $ip"); return undef; } - my $nettab = xCAT::Table->new('networks'); - unless ($nettab) { return undef } - my @nets = $nettab->getAllAttribs('net', 'mask', 'gateway'); - foreach (@nets) + + if(!defined($nets) ) { + my $nettab = xCAT::Table->new('networks'); + unless ($nettab) { return undef } + my @tmp_nets = $nettab->getAllAttribs('net', 'mask', 'gateway'); + $nets = \@tmp_nets; + } + foreach (@$nets) { my $net = $_->{'net'}; my $mask = $_->{'mask'};