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

Merge pull request #5715 from xuweibj/I5701

fix issue 5701, support site.httpport setting for xcatmn check
This commit is contained in:
Weihua Hu 2018-10-31 16:15:56 +08:00 committed by GitHub
commit affa429493
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 5 deletions

View File

@ -286,10 +286,20 @@ sub is_firewall_open {
sub is_http_ready {
my $mnip = shift;
$mnip = shift if (($mnip) && ($mnip =~ /probe_utils/));
my $httpport = shift;
my $installdir = shift;
my $errormsg_ref = shift;
my $http = "http://$mnip/$installdir/postscripts/syslog";
my $http_status = `netstat -tunlp | grep -e "httpd" -e "apache" | grep "LISTEN" 2>&1`;
if (!$http_status) {
$$errormsg_ref = "No HTTP listening status get by command 'netstat'";
return 0;
} elsif ($http_status !~ /\S*\s+\S*\s+\S*\s+\S*$httpport\s+.+/) {
$$errormsg_ref = "The port defined in 'site' table HTTP is not listening";
return 0;
}
my $http = "http://$mnip:$httpport/$installdir/postscripts/syslog";
my %httperror = (
"400" => "The request $http could not be understood by the server due to malformed syntax",
"401" => "The request requires user authentication.",

View File

@ -715,10 +715,18 @@ sub check_http_service {
push @$error_ref, "HTTP check need 'wget' tool, please install 'wget' tool and try again";
} else {
{
my $installdir = `lsdef -t site -i installdir -c 2>&1 | awk -F'=' '{print \$2}'`;
chomp($installdir);
my $httpinfo = `lsdef -t site -i installdir,httpport -c 2>&1`;
my $installdir = "";
my $httpport = 80;
if ($httpinfo =~ /clustersite: installdir=(\S*)/) {
$installdir = $1;
}
if ($httpinfo =~ /clustersite: httpport=(\S*)/) {
$httpport = $1;
}
unless($installdir){
push @$error_ref, "HTTP work path(installdir) isn't configured in 'sit' table";
push @$error_ref, "HTTP work path(installdir) isn't configured in 'site' table";
last;
}
@ -728,7 +736,7 @@ sub check_http_service {
}
my $errormsg;
unless(probe_utils->is_http_ready("$serverip", $installdir, \$errormsg)) {
unless(probe_utils->is_http_ready("$serverip", $httpport, $installdir, \$errormsg)) {
push @$error_ref, "$errormsg";
last;
}