summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Graumann <johannes_graumann@web.de>2012-10-15 23:02:06 +0300
committerPaul Klos <kolab@klos2day.nl>2012-10-24 07:35:34 -0400
commit00b2a137a4256ebbba872188305de39cc0abf743 (patch)
treec777a5ff0f94f1ee719550cf451af22fd199217c
parent89aada4795207c870da0b2cf9011d450685266f5 (diff)
downloadpykolab-00b2a137a4256ebbba872188305de39cc0abf743.tar.gz
Debianize: Check for existence of Debian-specific 'dirsrv' user and use for user/group default if present;
(cherry picked from commit 8624fe67b992c9a1f5d6e9b4c2f88eeaaafc67f0)
-rw-r--r--pykolab/setup/setup_ldap.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index 2960c49..59f69cf 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -20,6 +20,7 @@
import ldap
import ldap.modlist
import os
+import pwd
import shutil
import subprocess
import tempfile
@@ -109,14 +110,26 @@ def execute(*args, **kw):
""")
)
- _input['userid'] = utils.ask_question(_("User"), default="nobody")
- _input['group'] = utils.ask_question(_("Group"), default="nobody")
+ try:
+ pw = pwd.getpwnam("dirsrv")
+ except:
+ _input['userid'] = utils.ask_question(_("User"), default="nobody")
+ _input['group'] = utils.ask_question(_("Group"), default="nobody")
+ else:
+ _input['userid'] = utils.ask_question(_("User"), default="dirsrv")
+ _input['group'] = utils.ask_question(_("Group"), default="dirsrv")
else:
_input['admin_pass'] = conf.get('ldap', 'bind_pw')
_input['dirmgr_pass'] = conf.get('ldap', 'bind_pw')
- _input['userid'] = "nobody"
- _input['group'] = "nobody"
+ try:
+ pw = pwd.getpwnam("dirsrv")
+ except:
+ _input['userid'] = "nobody"
+ _input['group'] = "nobody"
+ else:
+ _input['userid'] = "dirsrv"
+ _input['group'] = "dirsrv"
# TODO: Verify the user and group exist.