2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-07-01 18:35:36 +00:00

defect 4730 addkitcomp/rmkitcomp cannot copy/remove kitcomp to otherpkgdir when there are mixed http and local dir in otherpkgdir

This commit is contained in:
amy0701
2015-07-06 08:23:16 -04:00
parent 66eb9fd7c6
commit 359ba4afd3

View File

@ -351,6 +351,35 @@ sub check_newinstall
}
#-------------------------------------------------------
=head3 get local otherpkgdir
otherpkgdir can be mixed http source and local dir
Split otherpkgdir
get local otherpkgdir
=cut
#-------------------------------------------------------
sub get_local_otherpkgdir
{
$otherpkgdir = shift;
my $localdir = "";
my @tempdirarray = split /,/, $otherpkgdir;
foreach my $tempdir (@tempdirarray){
$tempdir=~s/(^ +| +$)//g;
if ($tempdir !~ /^http.*/){
$localdir = $tempdir;
last;
}
}
return $localdir;
}
#-------------------------------------------------------
=head3 assign_to_osimage
@ -397,6 +426,9 @@ sub assign_to_osimage
my $rootimgdir;
if ( $linuximagetable and $linuximagetable->{otherpkgdir} ) {
$otherpkgdir = $linuximagetable->{otherpkgdir};
#support mixed otherpkgdir http and local dir
$otherpkgdir = get_local_otherpkgdir($otherpkgdir);
} else {
$callback->({error => ["Could not read otherpkgdir from osimage $osimage"],errorcode=>[1]});
return 1;
@ -576,6 +608,8 @@ sub assign_to_osimage
if ( $linuximagetable and $linuximagetable->{otherpkgdir} ) {
my $otherpkgdir = $linuximagetable->{otherpkgdir};
#support mixed otherpkgdir http and local dir
$otherpkgdir = get_local_otherpkgdir($otherpkgdir);
my $kitrepodir = $kitrepotable->{kitrepodir};
# Create otherpkgdir if it doesn't exist
@ -2743,6 +2777,8 @@ sub rmkitcomp
if ( $linuximagetable and $linuximagetable->{otherpkgdir} ) {
my $otherpkgdir = $linuximagetable->{otherpkgdir};
#support mixed otherpkgdir http and local dir
$otherpkgdir = get_local_otherpkgdir($otherpkgdir);
foreach my $kitcomponent (keys %kitcomps) {
my %newosikitcomponents;
@ -3265,6 +3301,8 @@ sub rmkitcomp
if ( $linuximagetable and $linuximagetable->{otherpkgdir} ) {
my $otherpkgdir = $linuximagetable->{otherpkgdir};
$otherpkgdir = get_local_otherpkgdir($otherpkgdir);
foreach my $kitcomponent (keys %kitcomps) {
my %newosikitcomponents;