From 4cdc6dab13a1cb7d02c87489e6bc43e7749cc731 Mon Sep 17 00:00:00 2001 From: jjhua Date: Fri, 31 May 2013 07:44:08 +0000 Subject: [PATCH] service node pool support for system X rhesl6.x git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16484 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Template.pm | 78 ++++++++++++++++----------- 1 file changed, 47 insertions(+), 31 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 6c2356d57..b4a659785 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -52,7 +52,6 @@ sub subvars { my $media_dir = shift; my $platform=shift; my $partitionfile=shift; - my $os=shift; my %namedargs = @_; #further expansion of this function will be named arguments, should have happened sooner. unless ($namedargs{reusemachinepass}) { $lastmachinepassdata->{password}=""; @@ -107,36 +106,6 @@ sub subvars { #replace the env with the right value so that correct include files can be found $inc =~ s/#ENV:([^#]+)#/envvar($1)/eg; - #support multiple paths of osimage in rh/sles diskfull installation - my @pkgdirs; - if ( defined($media_dir) ) { - @pkgdirs = split(",", $media_dir); - my $source; - my $c = 0; - foreach my $pkgdir(@pkgdirs) { - # For rhels5.9, the os base repo should be url - # and the repo repository will be the additional. So Corret it. - if( $platform =~ /^(rh|SL)$/ ) { - if ( $c == 0 ) { - $source .= "url --url http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; - } else { - $source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; } - } elsif ($platform =~ /^(sles|suse)/) { - my $http = "http://#TABLE:noderes:\$NODE:nfsserver#$pkgdir"; - $source .= " - $http - SuSE-Linux-pkg$c - / - false - SuSE-Linux-pkg$c - "; - } - $c++; - } - - $inc =~ s/#INSTALL_SOURCES#/$source/g; - } - if ($pkglistfile) { #substitute the tag #INCLUDE_DEFAULT_PKGLIST# with package file name (for full install of rh, centos,SL, esx fedora) $inc =~ s/#INCLUDE_DEFAULT_PKGLIST#/#INCLUDE:$pkglistfile#/g; @@ -201,6 +170,53 @@ sub subvars { } } + #support multiple paths of osimage in rh/sles diskfull installation + my @pkgdirs; + if ( defined($media_dir) ) { + @pkgdirs = split(",", $media_dir); + my $source; + my $source_rh5; + my $c = 0; + my @argskeys = keys( %namedargs ); + my $redhat5 = grep /^rhels5/, @argskeys; + foreach my $pkgdir(@pkgdirs) { + # For rhels5.9, the os base repo should be url + # and the repo repository will be the additional. So Corret it. + if( $redhat5 > 0 ) { + # After some tests, if we put the repo in pre scripts in the kickstart like for rhels6.x + if ( $c == 0 ) { + $source_rh5 .= "url --url http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; + } else { + $source_rh5 .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; + } + $c++; + next; + } + if( $platform =~ /^(rh|SL)$/ ) { + if ( $c == 0 ) { + $source .= "echo 'url --url http://'\$nextserver'/$pkgdir' >> /tmp/repos"; + } else { + $source .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver'/$pkgdir' >> /tmp/repos"; } + } elsif ($platform =~ /^(sles|suse)/) { + my $http = "http://#TABLE:noderes:\$NODE:nfsserver#$pkgdir"; + $source .= " + $http + SuSE-Linux-pkg$c + / + false + SuSE-Linux-pkg$c + "; + } + $c++; + } + + $inc =~ s/#INSTALL_SOURCES#/$source/g; + $inc =~ s/#INSTALL_SOURCES_RH5#/$source_rh5/g; + } + + + + #Support hierarchical include $inc =~ s/#ENV:([^#]+)#/envvar($1)/eg; if ($inc =~ /#INCLUDE:[^#^\n]+#/) {