To support site.precreatemypostscripts=1

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13990 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jjhua 2012-10-12 06:31:26 +00:00
parent 521da69833
commit 5a395d4da6

View File

@ -92,6 +92,33 @@ sub writescript
close($script);
chmod 0755, $scriptfile;
}
sub create_mypostscript_or_not {
my $request = shift;
my $callback = shift;
my $subreq = shift;
my $nodes = $request->{node};
my $tftpdir = xCAT::TableUtils::getTftpDir();
system("rm -rf $tftpdir/mypostscripts");
#if precreatemypostscripts=1, create each mypostscript for each node
my @entries = xCAT::TableUtils->get_site_attribute("precreatemypostscripts");
if ($entries[0] ) {
$entries[0] =~ tr/a-z/A-Z/;
if ($entries[0] =~ /^(1|YES)$/ ) {
require xCAT::Postage;
my $state;
if ($request->{scripttype}) { $state = $request->{scripttype}->[0];}
xCAT::Postage::makescript($nodes, $state, $callback);
}
}
}
#----------------------------------------------------------------------------
@ -118,6 +145,14 @@ sub makescript
my $nodesetstate = shift; # install or netboot
my $callback = shift;
#create the mypostscript for each node once according to the template
if(ref($node) eq "ARRAY") {
require xCAT::Template;
xCAT::Template->subvars_for_mypostscript($node, $nodesetstate, $callback);
return;
}
my @scriptd;
my ($master, $ps, $os, $arch, $profile);