You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by zh...@apache.org on 2017/11/09 09:44:51 UTC

ranger git commit: RANGER-1875:The installer of the kms should not repeatedly add a user to the same group.

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 <zh...@zte.com.cn>


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 <pe...@zte.com.cn>
Authored: Tue Nov 7 10:56:04 2017 +0800
Committer: zhangqiang2 <zh...@zte.com.cn>
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";