pre-create mypostscript enhancement: move mkdir out of the nodes loop

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14218 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jjhua 2012-11-02 06:55:05 +00:00
parent 9461e9194e
commit 300de0daf0

View File

@ -711,7 +711,7 @@ sub subvars_for_mypostscript {
$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 =
my $installroot;
my @entries = xCAT::TableUtils->get_site_attribute("installdir");
if($entries[0]) {
$installroot = $entries[0];
@ -797,6 +797,11 @@ sub subvars_for_mypostscript {
getservicenode();
#print Dumper(\%::GLOBAL_SN_HASH);
#
my $scriptdir = "$tftpdir/mypostscripts/";
if( ! (-d $scriptdir )) {
mkdir($scriptdir,0777);
}
foreach my $n (@$nodes ) {
$node = $n;
@ -804,7 +809,7 @@ sub subvars_for_mypostscript {
my $script;
my $scriptfile;
$scriptfile = "$tftpdir/mypostscripts/mypostscript.$node";
mkpath(dirname($scriptfile));
#mkpath(dirname($scriptfile));
open($script, ">$scriptfile");
unless ($script)