From bb4fa36b29d5a23c63897812ea3f3c7b1500dd53 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Mon, 6 Jan 2014 15:19:24 +0800 Subject: [PATCH] fixing the migration problem that rmkitcomp should remove the kitdeployment parameter file and its contents. --- xCAT-server/lib/xcat/plugins/kit.pm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index 864dfed1e..6c45f2139 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -3004,6 +3004,21 @@ sub rmkitcomp unless ( $match ) { my @contents = ();; if ( -e "$kitdir/other_files/$kitdeployfile" ) { + if (open(KITDEPLOY, "<", "$kitdir/other_files/$kitdeployfile") ) { + @contents = ; + close(KITDEPLOY); + if($::VERBOSE){ + my %rsp; + push@{ $rsp{data} }, "Reading kit deployparams from $kitdir/other_files/$kitdeployfile"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + } + } else { + my %rsp; + push@{ $rsp{data} }, "Could not open kit deployparams file $kitdir/other_files/$kitdeployfile"; + xCAT::MsgUtils->message( "E", \%rsp, $callback ); + return 1; + } + push @contents, "#INCLUDE:$kitdir/other_files/$kitdeployfile#"; } @@ -3040,6 +3055,16 @@ sub rmkitcomp my @otherdeployparams; my $deployparam_file = $kittable->{kitdir}."/other_files/".$kittable->{kitdeployparams}; if ( -e "$deployparam_file" ) { + + if (open(OTHERDEPLOYPARAM, "<", "$deployparam_file" )) { + @otherdeployparams = ; + close(OTHERDEPLOYPARAM); + } + + foreach ( @otherdeployparams ) { + push @otherlines, $_; + } + push @otherlines, "#INCLUDE:$deployparam_file#"; } }