support multiple paths of osimage in rh/sles diskfull installation
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15321 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
58e96b4a07
commit
841d58be57
@ -106,6 +106,31 @@ 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) {
|
||||
if( $platform =~ /^(rh|SL)$/ ) {
|
||||
$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 .= " <listentry>
|
||||
<media_url>$http</media_url>
|
||||
<product>SuSE-Linux-pkg$c</product>
|
||||
<product_dir>/</product_dir>
|
||||
<ask_on_error config:type=\"boolean\">false</ask_on_error> <!-- available since openSUSE 11.0 -->
|
||||
<name>SuSE-Linux-pkg$c</name> <!-- available since openSUSE 11.1/SLES11 (bnc#433981) -->
|
||||
</listentry>";
|
||||
}
|
||||
$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;
|
||||
@ -675,18 +700,18 @@ sub tabdb
|
||||
my $field = shift;
|
||||
my $blankok = shift;
|
||||
|
||||
|
||||
if( %::GLOBAL_TAB_HASH && defined( $::GLOBAL_TAB_HASH{$table}) && defined( $::GLOBAL_TAB_HASH{$table}{$key}) ) {
|
||||
|
||||
if( defined( %::GLOBAL_TAB_HASH) && defined( $::GLOBAL_TAB_HASH{$table} ) ) {
|
||||
if( !defined( $::GLOBAL_TAB_HASH{$table}{$key}) ) {
|
||||
return "''";
|
||||
}
|
||||
|
||||
if( defined($::GLOBAL_TAB_HASH{$table}{$key}{$field}) ) {
|
||||
return "'".$::GLOBAL_TAB_HASH{$table}{$key}{$field}."'";
|
||||
} else {
|
||||
my $msg;
|
||||
if( $field !~ /^(routenames)$/) {
|
||||
#if( $blankok != 1) {
|
||||
#$msg="\necho \"Warning! The $table.$field was NOT got. Please Check the node defintion and the template file mypostscript.tmpl. If the attribute will be used in your scripts, you need to define it on the Management Node firstly. If the attribute will not be used, you can ignore this message\"";
|
||||
}
|
||||
return $msg;
|
||||
return "''";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
my $tabh = xCAT::Table->new($table);
|
||||
@ -863,9 +888,9 @@ my $profile;
|
||||
my $arch;
|
||||
my $provmethod;
|
||||
my $mn;
|
||||
%::GLOBAL_TAB_HASH = ();
|
||||
%::GLOBAL_SN_HASH = ();
|
||||
%::GLOBAL_TABDUMP_HASH = ();
|
||||
%::GLOBAL_TAB_HASH;
|
||||
%::GLOBAL_SN_HASH;
|
||||
%::GLOBAL_TABDUMP_HASH;
|
||||
|
||||
sub subvars_for_mypostscript {
|
||||
my $self = shift;
|
||||
@ -1154,22 +1179,13 @@ sub subvars_for_mypostscript {
|
||||
$inc =~ s/tabdump\(([\w]+)\)/tabdump($1)/eg;
|
||||
$inc =~ s/#Subroutine:([^:]+)::([^:]+)::([^:]+):([^#]+)#/subroutine($1,$2,$3,$4)/eg;
|
||||
|
||||
#$inc =~ s/^([^#]+)=[\s]*export $1//eg;
|
||||
#remove the variable which equal blank.
|
||||
my @lines = split("\n", $inc);
|
||||
my $line;
|
||||
foreach $line ( @lines ) {
|
||||
if( $line =~ /^([^#]+)=[\s]*$/ ) {
|
||||
my $key=$1;
|
||||
$inc =~ s/$key=([\s\n]+)/$key=''\n/g;
|
||||
#$inc =~ s/$key=([\s\n]+)//g;
|
||||
#$inc =~ s/export $key//g;
|
||||
}
|
||||
}
|
||||
|
||||
print $script $inc;
|
||||
close($script_fp{$node});
|
||||
}
|
||||
|
||||
undef(%::GLOBAL_TAB_HASH);
|
||||
undef(%::GLOBAL_SN_HASH);
|
||||
undef(%::GLOBAL_TABDUMP_HASH);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1771,7 +1787,7 @@ sub collect_all_attribs_for_tables_in_template
|
||||
|
||||
my $ent;
|
||||
my $bynode=0;
|
||||
if ($key eq "THISNODE" or $key eq '$NODE') {
|
||||
#if ($key eq "THISNODE" or $key eq '$NODE') {
|
||||
if( $tabname =~ /^noderes$/ ) {
|
||||
@attribs = (@attribs, "netboot", "tftpdir"); ## add the attribs which will be needed in other place.
|
||||
}
|
||||
@ -1808,7 +1824,7 @@ sub collect_all_attribs_for_tables_in_template
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
# for noderes.nfsserver and noderes.tftpserver
|
||||
if( defined($::GLOBAL_TAB_HASH{noderes}) && defined ($::GLOBAL_TAB_HASH{noderes}{$node} )
|
||||
@ -1819,13 +1835,19 @@ sub collect_all_attribs_for_tables_in_template
|
||||
if(!defined ($::GLOBAL_TAB_HASH{noderes}{$node}{tftpserver}) ) {
|
||||
$::GLOBAL_TAB_HASH{noderes}{$node}{tftpserver} = $::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster};
|
||||
}
|
||||
} else {
|
||||
foreach my $attrib (@attribs) {
|
||||
$::GLOBAL_TAB_HASH{$tabname}{$node}{$attrib} = '';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$tabh->close;
|
||||
}
|
||||
#}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user