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 390AA200C52 for ; Mon, 27 Mar 2017 07:54:31 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 37AE3160B9D; Mon, 27 Mar 2017 05:54:31 +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 85D16160B87 for ; Mon, 27 Mar 2017 07:54:30 +0200 (CEST) Received: (qmail 46405 invoked by uid 500); 27 Mar 2017 05:54:29 -0000 Mailing-List: contact commits-help@trafodion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: commits@trafodion.apache.org Delivered-To: mailing list commits@trafodion.apache.org Received: (qmail 46390 invoked by uid 99); 27 Mar 2017 05:54:29 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Mar 2017 05:54:29 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id E6EDAC20DB for ; Mon, 27 Mar 2017 05:54:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.222 X-Spam-Level: X-Spam-Status: No, score=-4.222 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id nZlaFJ0GfAcf for ; Mon, 27 Mar 2017 05:54:28 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 4025F5FC3D for ; Mon, 27 Mar 2017 05:54:27 +0000 (UTC) Received: (qmail 46374 invoked by uid 99); 27 Mar 2017 05:54:26 -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; Mon, 27 Mar 2017 05:54:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4D885DFE7B; Mon, 27 Mar 2017 05:54:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hfutmkby@apache.org To: commits@trafodion.incubator.apache.org Date: Mon, 27 Mar 2017 05:54:26 -0000 Message-Id: <4640bc6680b044c3bc2001992653b421@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] incubator-trafodion git commit: [TRAFODION-2539] pyinstaller - set actual trafodion group if trafodion user exists archived-at: Mon, 27 Mar 2017 05:54:31 -0000 Repository: incubator-trafodion Updated Branches: refs/heads/release2.1 e8a88e5fa -> c58a1809f [TRAFODION-2539] pyinstaller - set actual trafodion group if trafodion user exists Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/3f85cf8b Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/3f85cf8b Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/3f85cf8b Branch: refs/heads/release2.1 Commit: 3f85cf8bf33712c50b84abf9c0e55693ef873166 Parents: a48a06d Author: Eason Authored: Thu Mar 16 17:22:39 2017 +0800 Committer: Eason Committed: Fri Mar 17 11:24:08 2017 +0800 ---------------------------------------------------------------------- install/python-installer/scripts/traf_user.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/3f85cf8b/install/python-installer/scripts/traf_user.py ---------------------------------------------------------------------- diff --git a/install/python-installer/scripts/traf_user.py b/install/python-installer/scripts/traf_user.py index 09a346a..05b132c 100755 --- a/install/python-installer/scripts/traf_user.py +++ b/install/python-installer/scripts/traf_user.py @@ -43,13 +43,12 @@ def run(): elif 'APACHE' in distro: hadoop_type = 'apache' - traf_user = dbcfgs['traf_user'] - traf_group = traf_user - home_dir = cmd_output('cat /etc/default/useradd |grep HOME |cut -d "=" -f 2').strip() + home_dir = cmd_output('cat /etc/default/useradd |grep HOME |cut -d "=" -f 2') # customize trafodion home dir if dbcfgs.has_key('home_dir') and dbcfgs['home_dir']: home_dir = dbcfgs['home_dir'] + traf_user = dbcfgs['traf_user'] traf_user_dir = '%s/%s' % (home_dir, traf_user) traf_dirname = dbcfgs['traf_dirname'] traf_home = '%s/%s' % (traf_user_dir, traf_dirname) @@ -60,13 +59,18 @@ def run(): ulimits_file = '/etc/security/limits.d/%s.conf' % traf_user # create trafodion user and group - if not cmd_output('getent group %s' % traf_group): - run_cmd('groupadd %s > /dev/null 2>&1' % traf_group) - - if not cmd_output('getent passwd %s' % traf_user): + if cmd_output('getent passwd %s' % traf_user): + # trafodion user exists, set actual trafodion group + traf_group = cmd_output('id -ng %s' % traf_user) + else: + # default trafodion group + traf_group = traf_user + if not cmd_output('getent group %s' % traf_group): + run_cmd('groupadd %s > /dev/null 2>&1' % traf_group) traf_pwd = dbcfgs['traf_pwd'] run_cmd('useradd --shell /bin/bash -m %s -g %s --home %s --password "$(openssl passwd %s)"' % (traf_user, traf_group, traf_user_dir, traf_pwd)) - elif not os.path.exists(traf_user_dir): + + if not os.path.exists(traf_user_dir): run_cmd('mkdir -p %s' % traf_user_dir) run_cmd('chmod 700 %s' % traf_user_dir)