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 00F11200D37 for ; Thu, 9 Nov 2017 10:44:53 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id F3A97160BEF; Thu, 9 Nov 2017 09:44:52 +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 4CAF71609E5 for ; Thu, 9 Nov 2017 10:44:52 +0100 (CET) Received: (qmail 35830 invoked by uid 500); 9 Nov 2017 09:44:51 -0000 Mailing-List: contact commits-help@ranger.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ranger.apache.org Delivered-To: mailing list commits@ranger.apache.org Received: (qmail 35821 invoked by uid 99); 9 Nov 2017 09:44:51 -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; Thu, 09 Nov 2017 09:44:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5F994DFC27; Thu, 9 Nov 2017 09:44:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: zhangqiang@apache.org To: commits@ranger.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: ranger git commit: RANGER-1875:The installer of the kms should not repeatedly add a user to the same group. Date: Thu, 9 Nov 2017 09:44:51 +0000 (UTC) archived-at: Thu, 09 Nov 2017 09:44:53 -0000 Repository: ranger Updated Branches: refs/heads/master 44691b556 -> 502f3cea6 RANGER-1875:The installer of the kms should not repeatedly add a user to the same group. Signed-off-by: zhangqiang2 Project: http://git-wip-us.apache.org/repos/asf/ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/502f3cea Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/502f3cea Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/502f3cea Branch: refs/heads/master Commit: 502f3cea682013f5ca4ea5e702f887aabc60e538 Parents: 44691b5 Author: peng.jianhua Authored: Tue Nov 7 10:56:04 2017 +0800 Committer: zhangqiang2 Committed: Thu Nov 9 04:26:28 2017 -0500 ---------------------------------------------------------------------- kms/scripts/setup.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ranger/blob/502f3cea/kms/scripts/setup.sh ---------------------------------------------------------------------- diff --git a/kms/scripts/setup.sh b/kms/scripts/setup.sh index 6e4b7e2..30999c2 100755 --- a/kms/scripts/setup.sh +++ b/kms/scripts/setup.sh @@ -750,8 +750,15 @@ EOF chpasswd < ${passwdtmpfile} rm -rf ${passwdtmpfile} else - log "[I] User already exists, adding it to group"; - usermod -g ${unix_group} ${unix_user} + useringroup=`id ${unix_user}` + useringrouparr=(${useringroup// / }) + if [[ ${useringrouparr[1]} =~ "(${unix_group})" ]] + then + log "[I] the ${unix_user} user already exists and belongs to group ${unix_group}" + else + log "[I] User already exists, adding it to group ${unix_group}" + usermod -g ${unix_group} ${unix_user} + fi fi log "[I] Setting up UNIX user : ${unix_user} and group: ${unix_group} DONE";