add check for nofiles and more than one node

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16336 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2013-05-16 16:45:38 +00:00
parent 43c5246b1a
commit c45ed81db3

View File

@ -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 ;
}