2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 17:23:08 +00:00

fix issue #2856: [DEV] nodes provisioned with redhat osimages created by xCAT 2.12.3 or earlier missed yum repo to MN in xCAT 2.12.4 or later (#2857)

* fix issue [DEV] nodes provisioned with redhat osimages created by xCAT 2.12.3 or earlier missed yum repo to MN in xCAT 2.12.4 or later #2856

* fix issue [DEV] nodes provisioned with redhat osimages created by xCAT 2.12.3 or earlier missed yum repo to MN in xCAT 2.12.4 or later #2856
This commit is contained in:
yangsong 2017-04-12 22:31:54 -05:00 committed by Bin Xu
parent 80cc015923
commit a761e64c0c
4 changed files with 21 additions and 7 deletions

View File

@ -9,12 +9,16 @@ my $distname;
my $arch;
my $installpfx;
my $distrepopfx="/install/postscripts/repos";
sub localize_yumrepo {
my $self = shift;
my $pkgdir = shift;
$distname=shift;
$arch=shift;
open($yumrepofile, ">", "$pkgdir/local-repository.tmpl");
mkpath("$distrepopfx/$pkgdir");
open($yumrepofile, ">", "$distrepopfx/$pkgdir/local-repository.tmpl");
my %options = (
wanted => \&check_tofix,
follow_fast => 1
@ -27,7 +31,7 @@ sub localize_yumrepo {
sub remove_yumrepo {
my $self = shift;
my $pkgdir = shift;
rmtree("$pkgdir/local-repository.tmpl");
rmtree("$distrepopfx/$pkgdir/local-repository.tmpl");
}
sub check_tofix {

View File

@ -303,11 +303,12 @@ sub subvars {
$source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver'/$pkgdir' >> /tmp/repos";
$source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #for rhels5.9
}
if( -f "$pkgdir/local-repository.tmpl"){
my $distrepofile="/install/postscripts/repos/$pkgdir/local-repository.tmpl";
if( -f "$distrepofile"){
my $repofd;
my $repo_in_post;
local $/=undef;
open($repofd,"<","$pkgdir/local-repository.tmpl");
open($repofd,"<","$distrepofile");
$repo_in_post = <$repofd>;
close($repofd);
$repo_in_post =~ s#baseurl=#baseurl=http://$master/#g;

View File

@ -1260,6 +1260,15 @@ sub mkinstall
}
}
unless(-f "/install/postscripts/repos/$pkgdir/local-repository.tmpl"){
#fix issue #2856@github
#for the osimages created by <=xCAT 2.12.3
#there is no local-repository.tmpl under pkgdir created on copycds
#generate local-repository.tmpl here if it does not exist
require xCAT::Yum;
xCAT::Yum->localize_yumrepo($pkgdir, $os, $arch);
}
my @missingparms;
unless ($os) {
if ($imagename) { push @missingparms, "osimage.osvers"; }

View File

@ -410,9 +410,9 @@ export ARCH=#TABLE:nodetype:THISNODE:arch#
export CONSOLEPORT=#TABLEBLANKOKAY:nodehm:THISNODE:serialport#
#for redhat:
##place-holder for the code to save the repo info on compute node,pointing to the "pkgdir" of the osimage
##so that the provisioned node
##WRITEREPO#
#place-holder for the code to save the repo info on compute node,pointing to the "pkgdir" of the osimage
#so that the provisioned node has the repo pointed to the distro path on MN
#WRITEREPO#
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
msgutil_r "$MASTER_IP" "info" "running mypostscript" "/var/log/xcat/xcat.log"