From 300de0daf0777f0e10401b2303ffb44e3d116747 Mon Sep 17 00:00:00 2001 From: jjhua Date: Fri, 2 Nov 2012 06:55:05 +0000 Subject: [PATCH] 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 --- xCAT-server/lib/perl/xCAT/Template.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 10d22d4c0..ec7d6e736 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -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)