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

fix [FVT]:mysqlsetup -i failed to setup database on sles12 #1413 ;refine the logic to determine hostname of the master

This commit is contained in:
immarvin
2016-07-28 01:37:28 -04:00
parent b8c553d329
commit 45c1dc0f92

View File

@@ -405,12 +405,8 @@ if (($::INIT) && ($::xcatrunningmysql == 0))
my $cmd = "grep master $sitefile";
my @output = xCAT::Utils->runcmd($cmd, -1);
my $hname;
if ($::RUNCMD_RC != 0) # no entry in site table
{
$hname = `hostname`;
chomp $hname;
}
else # from site.master
# from site.master
if ($::RUNCMD_RC == 0 )
{
(my $attr, my $master) = split(",", $output[0]);
(my $q, $hname) = split("\"", $master);
@@ -418,6 +414,11 @@ if (($::INIT) && ($::xcatrunningmysql == 0))
}
if( "$hname" eq ""){
$hname = `hostname`;
chomp $hname;
}
#my ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname($hname);
my $ipaddr = xCAT::NetworkUtils->getipaddr($hname);
if ($ipaddr)