summaryrefslogtreecommitdiffstats
path: root/ipaserver/install
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-02-03 16:44:29 -0500
committerJason Gerard DeRose <jderose@redhat.com>2010-03-16 22:42:39 -0600
commit53d1cf1644df37843253be2df176f7bdd5d12a31 (patch)
tree739b7ec5fc53a5e23f80b435a4f49f6282fab56b /ipaserver/install
parent4216a627c3d614e3c0804449c80d2f59bba60b05 (diff)
downloadfreeipa-53d1cf1644df37843253be2df176f7bdd5d12a31.tar.gz
freeipa-53d1cf1644df37843253be2df176f7bdd5d12a31.tar.xz
freeipa-53d1cf1644df37843253be2df176f7bdd5d12a31.zip
Handle the case where the DS group exists but the user does not
If the group exists but the user doesn't then useradd blows up trying to create the user and group. So test to see if the group exists and if it does pass along the -g argument to useradd. Resolves #502960
Diffstat (limited to 'ipaserver/install')
-rw-r--r--ipaserver/install/dsinstance.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index 4fcb914c..9a71b7f5 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -21,6 +21,7 @@
import shutil
import logging
import pwd
+import grp
import glob
import sys
import os
@@ -218,6 +219,14 @@ class DsInstance(service.Service):
logging.debug("adding ds user %s" % self.ds_user)
args = ["/usr/sbin/useradd", "-c", "DS System User", "-d", "/var/lib/dirsrv", "-M", "-r", "-s", "/sbin/nologin", self.ds_user]
try:
+ # if the group already exists we need to request to add it,
+ # otherwise useradd will create it for us
+ grp.getgrnam(self.ds_user)
+ args.append("-g")
+ args.append(self.ds_user)
+ except KeyError:
+ pass
+ try:
ipautil.run(args)
logging.debug("done adding user")
except ipautil.CalledProcessError, e: