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/08/23 01:44:49 UTC

ranger git commit: RANGER-1742:Like setup.sh, the set_globals.sh should check whether the user group exists before created user group in security admin.

Repository: ranger
Updated Branches:
  refs/heads/master b676cd920 -> a16889fbb


RANGER-1742:Like setup.sh, the set_globals.sh should check whether the user group exists before created user group in security admin.

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/a16889fb
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/a16889fb
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/a16889fb

Branch: refs/heads/master
Commit: a16889fbbd189ea6282030b528f8d17fac79144a
Parents: b676cd9
Author: peng.jianhua <pe...@zte.com.cn>
Authored: Sun Aug 20 09:27:54 2017 -0400
Committer: zhangqiang2 <zh...@zte.com.cn>
Committed: Tue Aug 22 21:43:58 2017 -0400

----------------------------------------------------------------------
 security-admin/scripts/set_globals.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/a16889fb/security-admin/scripts/set_globals.sh
----------------------------------------------------------------------
diff --git a/security-admin/scripts/set_globals.sh b/security-admin/scripts/set_globals.sh
index 5e985e2..b0b400b 100755
--- a/security-admin/scripts/set_globals.sh
+++ b/security-admin/scripts/set_globals.sh
@@ -60,13 +60,17 @@ log() {
 unix_user=$(get_prop 'unix_user' $PROPFILE)
 unix_group=$(get_prop 'unix_group' $PROPFILE)
 
-groupadd ${unix_group}
-ret=$?
-if [ $ret -ne 0 ] && [ $ret -ne 9 ]; then
-	echo "Error creating group $unix_group"
-	exit 1
+#create group if it does not exist
+egrep "^$unix_group" /etc/group >& /dev/null
+if [ $? -ne 0 ]; then
+	groupadd ${unix_group}
+	ret=$?
+	if [ $ret -ne 0 ] && [ $ret -ne 9 ]; then
+		echo "Error creating group $unix_group"
+		exit 1
+	fi
 fi
-
+#create user if it does not exists
 id -u ${unix_user} > /dev/null 2>&1
 if [ $? -ne 0 ]; then
     useradd ${unix_user} -g ${unix_group} -m