From 56d12b7105dbec4bc3103cc6548f07a64ecbbced Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 16 May 2013 16:45:16 +0000 Subject: [PATCH] add check for nofiles and more than one node git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16335 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Postage.pm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index 13b3c8c82..a400549c4 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -164,9 +164,18 @@ sub makescript { my $notmpfiles = shift; my $nofiles = shift; $tmplerr=undef; #clear tmplerr since we are starting fresh - my %namedargs = @_; #further expansion of this function will be named arguments, should have happened sooner. - - my $installroot; + + # + # check if nofiles = 1 , then there should be only one node input + # + my $arraySize = @$nodes; + if ((defined($nofiles)) && ($nofiles == 1) && ($arraySize > 1)) { + my $rsp; + $rsp->{data}->[0]= "makescript called with nofiles=$nofiles, but more than one node input. This is a software error."; + xCAT::MsgUtils->message("SE", $rsp, $callback,1); + return ; + } + my $installroot="/install"; # set default my @entries = xCAT::TableUtils->get_site_attribute("installdir"); if($entries[0]) { $installroot = $entries[0]; @@ -180,7 +189,7 @@ sub makescript { unless ( -r "$tmpl") { my $rsp; $rsp->{data}->[0]= "site.precreatemypostscripts is set to 1 or yes. No mypostscript template exists in directory /install/postscripts or $::XCATROOT/share/xcat/templates/mypostscript/mypostscript.tmpl.\n"; - xCAT::MsgUtils->message("E", $rsp, $callback,1); + xCAT::MsgUtils->message("SE", $rsp, $callback,1); return ; }