Fixing bug 3410: don't remove kitrepo if there is other kitcomponent assigned to the osimage

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15759 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wanghuaz 2013-04-01 10:37:42 +00:00
parent ef7ebb34b8
commit 89209d885b

View File

@ -2136,9 +2136,26 @@ sub rmkitcomp
my $otherpkgdir = $linuximagetable->{otherpkgdir};
foreach my $kitcomponent (keys %kitcomps) {
if ( $kitcomps{$kitcomponent}{kitreponame} ) {
if ( -d "$otherpkgdir/$kitcomps{$kitcomponent}{kitreponame}" ) {
system("rm -rf $otherpkgdir/$kitcomps{$kitcomponent}{kitreponame}");
# Check if this repo is used by other kitcomponent before removing the link
my $match = 0;
foreach my $osikitcomp ( @osikitcomps ) {
next if ( $osikitcomp =~ /$kitcomponent/ );
my $depkitrepodir;
(my $kitcomptable) = $tabs{kitcomponent}->getAttribs({kitcompname => $osikitcomp}, 'kitreponame');
if ( $kitcomptable and $kitcomptable->{kitreponame} ) {
$depkitrepodir = "$otherpkgdir/$kitcomptable->{kitreponame}";
}
if ( $depkitrepodir =~ /^$otherpkgdir\/$kitcomps{$kitcomponent}{kitreponame}$/) {
$match = 1;
}
}
if ( !$match ) {
system("rm -rf $otherpkgdir/$kitcomps{$kitcomponent}{kitreponame}");
}
}
}
}