From 05f66ec8fc12a0cd578246f0fc0c5e3c1508d9aa Mon Sep 17 00:00:00 2001 From: jjhua Date: Fri, 2 Nov 2012 07:03:44 +0000 Subject: [PATCH] pre-create mypostscript enhancement: remove the old mypostscript. if site.precreatemypostscripts=0 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14219 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Postage.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index 82558f6e2..454a63e72 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -101,7 +101,6 @@ sub create_mypostscript_or_not { 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] ) { @@ -112,7 +111,13 @@ sub create_mypostscript_or_not { if ($request->{scripttype}) { $state = $request->{scripttype}->[0];} xCAT::Postage::makescript($nodes, $state, $callback); } - } + } else { + #if the site.precreatemypostscripts=0, we will remove the mypostscript.$n + foreach my $n (@$nodes ) { + unlink("$tftpdir/mypostscripts/mypostscript.$n"); + } + } + }