2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-14 02:10:23 +00:00

modify depending on gongjie'comment

This commit is contained in:
hu-weihua
2016-12-21 03:07:46 -05:00
parent e3cfd47466
commit 0d3beb67c9

View File

@ -295,10 +295,12 @@ sub is_http_ready {
"504" => "The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI or some other auxiliary server it needed to access in attempting to complete the request.",
"505" => "The server does not support, or refuses to support, the HTTP protocol version that was used in the request message.");
my $suffix = time();
my $tmpdir = "/tmp/xcatprobe$suffix/";
mkpath("$tmpdir");
my @outputtmp = `cd $tmpdir && wget $http 2>&1`;
my $tmpdir = "/tmp/xcatprobe$$/";
if(! mkpath("$tmpdir")){
$$errormsg_ref = "Prepare test environment error: $!";
return 0;
}
my @outputtmp = `wget -O $tmpdir/syslog $http 2>&1`;
my $rst = $?;
$rst = $rst >> 8;
@ -320,10 +322,13 @@ sub is_http_ready {
$$errormsg_ref = $httperror{$returncode};
}else{
#should not hit this block normally
$$errormsg_ref = "Unexpected return code of wget <$returncode>.";
$$errormsg_ref = "Unknown return code of wget <$returncode>.";
}
}
rmdir ("$tmpdir");
unlink("$tmpdir/syslog");
if(! rmdir ("$tmpdir")){
$$errormsg_ref .= " Clean test environment error(rmdir $tmpdir): $!";
}
return 0;
}