From 88f35c5e0e2878c8c01bc7af16dc0bcd8de3971c Mon Sep 17 00:00:00 2001 From: jjhua Date: Fri, 31 May 2013 08:34:10 +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/trunk@16495 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..4a0dbe28f 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_in_pre; + 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 .= "url --url http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; + } else { + $source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; + } + $c++; + next; + } + if( $platform =~ /^(rh|SL)$/ ) { + if ( $c == 0 ) { + $source_in_pre .= "echo 'url --url http://'\$nextserver'/$pkgdir' >> /tmp/repos"; + } else { + $source_in_pre .= "\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_IN_PRE#/$source_in_pre/g; + } + + + + #Support hierarchical include $inc =~ s/#ENV:([^#]+)#/envvar($1)/eg; if ($inc =~ /#INCLUDE:[^#^\n]+#/) {