diff --git a/perl-xCAT/xCAT/Client.pm b/perl-xCAT/xCAT/Client.pm
index e6b1e1d04..fc778c721 100644
--- a/perl-xCAT/xCAT/Client.pm
+++ b/perl-xCAT/xCAT/Client.pm
@@ -1037,6 +1037,11 @@ sub populate_site_hash {
foreach (@records) {
$::XCATSITEVALS{ $_->{key} } = $_->{value};
}
+
+ unless (exists($::XCATSITEVALS{'httpport'}) and ($::XCATSITEVALS{'httpport'} ne "")){
+ $::XCATSITEVALS{'httpport'}="80";
+ }
+
}
diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm
index 513a1a9e6..c43753b27 100644
--- a/xCAT-server/lib/perl/xCAT/Template.pm
+++ b/xCAT-server/lib/perl/xCAT/Template.pm
@@ -146,7 +146,7 @@ sub subvars {
}
$ENV{HTTPPORT} = $httpport;
-
+ my $httpportsuffix=":$httpport";
#replace the env with the right value so that correct include files can be found
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
my $res;
@@ -303,11 +303,11 @@ sub subvars {
if ($c == 0) {
# After some tests, if we put the repo in pre scripts in the kickstart like for rhels6.x
# the rhels5.9 will not be installed successfully. So put in kickstart directly.
- $source_in_pre .= "echo 'url --url http://'\$nextserver':$httpport/$pkgdir' >> /tmp/repos";
- $source .= "url --url http://#TABLE:noderes:\$NODE:nfsserver#:#TABLE:site:key=httpport:value#/$pkgdir\n"; #For rhels5.9
+ $source_in_pre .= "echo 'url --url http://'\$nextserver'$httpportsuffix/$pkgdir' >> /tmp/repos";
+ $source .= "url --url http://#TABLE:noderes:\$NODE:nfsserver#$httpportsuffix/$pkgdir\n"; #For rhels5.9
} else {
- $source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver':$httpport/$pkgdir' >> /tmp/repos";
- $source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#:#TABLE:site:key=httpport:value#/$pkgdir\n"; #for rhels5.9
+ $source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver'$httpportsuffix/$pkgdir' >> /tmp/repos";
+ $source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#$httpportsuffix/$pkgdir\n"; #for rhels5.9
}
my $distrepofile="/install/postscripts/repos/$pkgdir/local-repository.tmpl";
if( -f "$distrepofile"){
@@ -317,13 +317,13 @@ sub subvars {
open($repofd,"<","$distrepofile");
$repo_in_post = <$repofd>;
close($repofd);
- $repo_in_post =~ s#baseurl=#baseurl=http://$master:$httpport/#g;
+ $repo_in_post =~ s#baseurl=#baseurl=http://$master$httpportsuffix/#g;
$writerepo .= "\ncat >/etc/yum.repos.d/local-repository-$c.repo << 'EOF'\n";
$writerepo .="$repo_in_post\n";
$writerepo .="EOF\n";
}
} elsif ($platform =~ /^(sles|suse)/) {
- my $http = "http://#TABLE:noderes:\$NODE:nfsserver#:#TABLE:site:key=httpport:value#$pkgdir";
+ my $http = "http://#TABLE:noderes:\$NODE:nfsserver#$httpportsuffix/$pkgdir";
$source .= "
$http
SuSE-Linux-pkg$c
@@ -331,7 +331,7 @@ sub subvars {
false
SuSE-Linux-pkg$c
";
- $source_in_pre .= "http://'\$nextserver':$httpport$pkgdirSuSE-Linux-pkg$c/falseSuSE-Linux-pkg$c";
+ $source_in_pre .= "http://'\$nextserver'$httpportsuffix$pkgdirSuSE-Linux-pkg$c/falseSuSE-Linux-pkg$c";
} elsif ($platform =~ /^sle15*/) {
if ( -d "$pkgdir") {
opendir(DIR,$pkgdir);
@@ -347,7 +347,7 @@ sub subvars {
$product_name=$subdir;
}
if (defined($product_name) && defined($product_dir)){
- $source .="http://XCATNEXTSERVERHOOK:$httpport$pkgdir$product_name/$product_dir";
+ $source .="http://XCATNEXTSERVERHOOK$httpportsuffix$pkgdir$product_name/$product_dir";
}
}
}
@@ -400,7 +400,7 @@ sub subvars {
$inc =~ s/#UNCOMMENTOENABLESSH#/ /g;
}
- my $sles_sdk_media = "http://" . $tmpl_hash->{tftpserver}.':'.$httpport . $media_dir . "/sdk1";
+ my $sles_sdk_media = "http://" . $tmpl_hash->{tftpserver}.$httpportsuffix . $media_dir . "/sdk1";
$inc =~ s/#SLES_SDK_MEDIA#/$sles_sdk_media/eg;
diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd
index 5ecc294de..0f55e83c6 100755
--- a/xCAT-server/sbin/xcatd
+++ b/xCAT-server/sbin/xcatd
@@ -2625,6 +2625,10 @@ sub populate_site_hash {
foreach (@records) {
$::XCATSITEVALS{ $_->{key} } = $_->{value};
}
+
+ unless (exists($::XCATSITEVALS{'httpport'}) and ($::XCATSITEVALS{'httpport'} ne "")){
+ $::XCATSITEVALS{'httpport'}="80";
+ }
}
sub populate_vpd_hash {