summaryrefslogtreecommitdiff
path: root/pykolab/utils.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-13 15:45:13 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-13 15:45:13 (GMT)
commita154359af4f205caa694f1dcebbaf03490c1c3ae (patch)
treeb6801a355a063c6420ea257c8b3f30961fc1486a /pykolab/utils.py
parent957e51a28d2961d31cbac32b21c4f2ec01c20774 (diff)
downloadpykolab-a154359af4f205caa694f1dcebbaf03490c1c3ae.tar.gz
Only create directories that do not already exist
Do not use log it doesn't exist here
Diffstat (limited to 'pykolab/utils.py')
-rw-r--r--pykolab/utils.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/pykolab/utils.py b/pykolab/utils.py
index f766983..ba9e13c 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -122,7 +122,9 @@ def ask_confirmation(question, default="y", all_inclusive_no=True):
return True
def ensure_directory(_dir, _user='root', _group='root'):
- os.makedirs(_dir)
+ if not os.path.isdir(_dir):
+ os.makedirs(_dir)
+
try:
try:
(ruid, euid, suid) = os.getresuid()
@@ -182,17 +184,15 @@ def ensure_directory(_dir, _user='root', _group='root'):
# Set real and effective user if not the same as current.
if not user_uid == ruid:
- log.debug(
- _("Switching real and effective user id to %d") % (
- user_uid
- ),
- level=8
- )
+ print >> sys.stderr, \
+ _("Switching real and effective user id to %d") % (
+ user_uid
+ )
os.chown(_dir, user_uid, -1)
except:
- log.error(_("Could not change the permissions on %s") % (_dir))
+ print >> sys.stderr, _("Could not change the permissions on %s") % (_dir)
def generate_password():
import subprocess