Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CE18A200B49 for ; Wed, 3 Aug 2016 22:48:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CCA35160A86; Wed, 3 Aug 2016 20:48:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2198B160A5D for ; Wed, 3 Aug 2016 22:48:17 +0200 (CEST) Received: (qmail 96669 invoked by uid 500); 3 Aug 2016 20:48:17 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 96660 invoked by uid 99); 3 Aug 2016 20:48:17 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Aug 2016 20:48:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 23206E3839; Wed, 3 Aug 2016 20:48:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lavjain@apache.org To: commits@ambari.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-17937:Ambari install/init should create a new gpadmin database (lavjain) Date: Wed, 3 Aug 2016 20:48:17 +0000 (UTC) archived-at: Wed, 03 Aug 2016 20:48:19 -0000 Repository: ambari Updated Branches: refs/heads/branch-2.4 773b128b8 -> 8138a9dbe AMBARI-17937:Ambari install/init should create a new gpadmin database (lavjain) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8138a9db Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8138a9db Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8138a9db Branch: refs/heads/branch-2.4 Commit: 8138a9dbee872e1a5309fa929a678fb7ff806b98 Parents: 773b128 Author: ljainpivotalio Authored: Wed Aug 3 13:48:07 2016 -0700 Committer: ljainpivotalio Committed: Wed Aug 3 13:48:07 2016 -0700 ---------------------------------------------------------------------- .../HAWQ/2.0.0/package/scripts/common.py | 14 ++++++++------ .../HAWQ/2.0.0/package/scripts/utils.py | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/8138a9db/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py index 8c43555..298513c 100644 --- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py @@ -31,7 +31,6 @@ import xml.etree.ElementTree as ET import utils import hawq_constants import custom_params -import hawqstatus def setup_user(): """ @@ -291,15 +290,18 @@ def start_component(component_name, port, data_dir): mode=0755) params.HdfsResource(None, action="execute") + options_str = "{0} -a -v".format(component_name) if os.path.exists(os.path.join(data_dir, hawq_constants.postmaster_opts_filename)): - return utils.exec_hawq_operation(hawq_constants.START, - "{0} -a -v".format(component_name), + return utils.exec_hawq_operation(hawq_constants.START, options_str, not_if=utils.generate_hawq_process_status_cmd(component_name, port)) - options_str = "{0} -a -v".format(component_name) + # Initialize HAWQ if component_name == hawq_constants.MASTER: - options_str+=" --ignore-bad-hosts" - utils.exec_hawq_operation(hawq_constants.INIT, options_str) + utils.exec_hawq_operation(hawq_constants.INIT, options_str + " --ignore-bad-hosts") + utils.exec_psql_cmd('create database {0};'.format(hawq_constants.hawq_user), + params.hawqmaster_host, params.hawq_master_address_port, ignore_error=True) + else: + utils.exec_hawq_operation(hawq_constants.INIT, options_str) def stop_component(component_name, mode): """ http://git-wip-us.apache.org/repos/asf/ambari/blob/8138a9db/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py index 55a5982..95c3dcc 100644 --- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py @@ -88,7 +88,7 @@ def exec_ssh_cmd(hostname, cmd): return process.returncode, stdout, stderr -def exec_psql_cmd(command, host, port, db=hawq_constants.POSTGRES, tuples_only=True): +def exec_psql_cmd(command, host, port, db=hawq_constants.POSTGRES, tuples_only=True, ignore_error=False): """ Sets up execution environment and runs the HAWQ queries """ @@ -100,7 +100,8 @@ def exec_psql_cmd(command, host, port, db=hawq_constants.POSTGRES, tuples_only=T retcode, out, err = exec_ssh_cmd(host, cmd) if retcode: Logger.error("SQL command executed failed: {0}\nReturncode: {1}\nStdout: {2}\nStderr: {3}".format(cmd, retcode, out, err)) - raise Fail("SQL command executed failed.") + if not ignore_error: + raise Fail("SQL command executed failed.") Logger.info("Output:\n{0}".format(out)) return retcode, out, err