summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-09-11 00:39:58 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-09-11 00:39:58 +0200
commitc8e843ce00f0e9d1f91ec1cb8575370a6508b173 (patch)
tree8e2a84efea2cb85e4ffee51b4fd287585c552300
parent8afe6d324b5baad759ed17128be39be1580bae69 (diff)
downloadpykolab-c8e843ce00f0e9d1f91ec1cb8575370a6508b173.tar.gz
Adjust logger.py to not bail on --user=$x not being actual users
-rw-r--r--pykolab/logger.py30
1 files changed, 12 insertions, 18 deletions
diff --git a/pykolab/logger.py b/pykolab/logger.py
index cce43f5..51f3e12 100644
--- a/pykolab/logger.py
+++ b/pykolab/logger.py
@@ -135,12 +135,8 @@ class Logger(logging.Logger):
group_members
) = grp.getgrnam(self.process_groupname)
- except KeyError:
- print >> sys.stderr, _("Group %s does not exist") % (
- self.process_groupname
- )
-
- sys.exit(1)
+ except KeyError, errmsg:
+ group_name = False
if ruid == 0:
# Means we haven't switched yet.
@@ -155,21 +151,19 @@ class Logger(logging.Logger):
user_shell
) = pwd.getpwnam(self.process_username)
- except KeyError:
- print >> sys.stderr, _("User %s does not exist") % (
- self.process_username
- )
-
- sys.exit(1)
+ except KeyError, errmsg:
+ user_name = False
if os.path.isfile(self.logfile):
try:
- os.chown(
- self.logfile,
- user_uid,
- group_gid
- )
- os.chmod(self.logfile, 0660)
+ if not user_uid == 0 or group_gid = 0:
+ os.chown(
+ self.logfile,
+ user_uid,
+ group_gid
+ )
+ os.chmod(self.logfile, 0660)
+
except Exception, errmsg:
self.error(_("Could not change permissions on %s: %r") % (self.logfile, errmsg))
if self.debuglevel > 8: