fixed some of the error processing

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12974 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2012-05-31 15:10:32 +00:00
parent 9fd00d35f6
commit 81c02cd17b

View File

@ -161,8 +161,8 @@ if (grep(/postgresql90/, @output)) { # postgresql 9.0
}
# check to see if PostgreSQL is running
$::pgsqlrunning = 0;
$::xcatrunningpgsql = 0;
my $pgsqlrunning = 0;
my $xcatrunningpgsql = 0;
my $cmd = "ps -ef | grep postgres";
my @output = xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC == 0) # already running
@ -171,13 +171,7 @@ if ($::RUNCMD_RC == 0) # already running
if (grep(/$pgsqlcheck/, @output))
{
if ($::INIT)
{
my $message =
"PostgreSQL is running. Database initialization will not take place.";
xCAT::MsgUtils->message("I", "$message");
}
$::pgsqlrunning = 1;
$pgsqlrunning = 1;
}
}
if (-e ("/etc/xcat/cfgloc")) # check to see if xcat is using pgsql
@ -192,14 +186,14 @@ if (-e ("/etc/xcat/cfgloc")) # check to see if xcat is using pgsql
"The /etc/xcat/cfgloc file is already configured for PostgreSQL. xcat database initialization will not take place.";
xCAT::MsgUtils->message("I", "$message");
}
$::xcatrunningpgsql = 1;
$xcatrunningpgsql = 1;
}
}
# if not just odbc update
# Get admin password or use the env variable
#
if (($odbconly == 0) && ($::xcatrunningpgsql == 0))
if (($odbconly == 0) && ($xcatrunningpgsql == 0))
{ # not just updating the odbc and xcat not already running on pg
if ($ENV{'XCATPGPW'}) # passwd supplied
{
@ -215,7 +209,7 @@ if (($odbconly == 0) && ($::xcatrunningpgsql == 0))
}
# initial setup request and not already running pgsql
if (($::INIT) && ($::xcatrunningpgsql == 0))
if (($::INIT) && ($xcatrunningpgsql == 0))
{
@ -270,40 +264,39 @@ if (($::INIT) && ($::xcatrunningpgsql == 0))
exit(1);
}
# PostgreSQL not running, then initialize the database
if ($::pgsqlrunning == 0)
# Add postgres user and group and xcatadm for AIX
# create the /var/lib/pgsql data directory and set permissions.
# All this is done on Linux install automatically:
# postgres is created on Linux and xcatadm does not need to be a
# real userid on Linux. Also directory permissions are correct on Linux
#
if ($::osname eq 'AIX')
{
# Add postgres user and group and xcatadm for AIX
# create the /var/lib/pgsql data directory and set permissions.
# All this is done on Linux install automatically:
# postgres is created on Linux and xcatadm does not need to be a
# real userid on Linux. Also directory permissions are correct on Linux
#
if ($::osname eq 'AIX')
{
&mkpgusers;
}
#
# Init Pg database and setup pg_hba.conf and postgresql.conf
#
&initpgdb;
#
# Start Postgresql server
#
&pgstart;
#
# Setup Postgresql to restart on reboot
#
&pgreboot;
&mkpgusers;
}
#
# Init Pg database and setup pg_hba.conf and postgresql.conf
#
&initpgdb;
#
# Start Postgresql server
#
if ($pgsqlrunning == 0) # if not already running
{
&pgstart;
}
#
# Setup Postgresql to restart on reboot
#
&pgreboot;
# if xcat not already configured to run Postgresql add xCAT database
if ($::xcatrunningpgsql == 0)
if ($xcatrunningpgsql == 0)
{
#