From 45c1dc0f92ac34062572d93010901218f9cb4d8d Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 28 Jul 2016 01:37:28 -0400 Subject: [PATCH] fix [FVT]:mysqlsetup -i failed to setup database on sles12 #1413 ;refine the logic to determine hostname of the master --- xCAT-client/bin/mysqlsetup | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/xCAT-client/bin/mysqlsetup b/xCAT-client/bin/mysqlsetup index 5a4ccbf8c..e61857a20 100755 --- a/xCAT-client/bin/mysqlsetup +++ b/xCAT-client/bin/mysqlsetup @@ -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)