You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by hf...@apache.org on 2017/03/27 05:54:26 UTC

[1/2] incubator-trafodion git commit: [TRAFODION-2539] pyinstaller - set actual trafodion group if trafodion user exists

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 <hf...@gmail.com>
Authored: Thu Mar 16 17:22:39 2017 +0800
Committer: Eason <hf...@gmail.com>
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)
 


[2/2] incubator-trafodion git commit: Merge [TRAFODION-2539] PR-1014 pyinstaller - set actual trafodion group if trafodion user exists

Posted by hf...@apache.org.
Merge [TRAFODION-2539] PR-1014 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/c58a1809
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/c58a1809
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/c58a1809

Branch: refs/heads/release2.1
Commit: c58a1809f24a206ce8dd55e2fe8761b69e5a2fa4
Parents: e8a88e5 3f85cf8
Author: Yi (Eason) Zhang <hf...@apache.org>
Authored: Mon Mar 27 13:35:37 2017 +0800
Committer: Yi (Eason) Zhang <hf...@apache.org>
Committed: Mon Mar 27 13:35:37 2017 +0800

----------------------------------------------------------------------
 install/python-installer/scripts/traf_user.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------