From a13fbaca0512cae3853a2372d0d8237eb24dd225 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Wed, 13 Jul 2011 00:52:14 +0200 Subject: gsyncd: do some basic sanitization on logs - exceptions raised by us will be logged as single-line error messages (full stack strace is shown only at DEBUG loglevel) - common/well understood exceptions are mapped to "user-parsable" error logs Change-Id: I75f1fb848483372364b2093878d9cfed576c9739 BUG: 2778 Reviewed-on: http://review.gluster.com/125 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/features/marker/utils/syncdaemon/gsyncd.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'xlators/features/marker/utils/syncdaemon/gsyncd.py') diff --git a/xlators/features/marker/utils/syncdaemon/gsyncd.py b/xlators/features/marker/utils/syncdaemon/gsyncd.py index 313bfdb0..fb1dc1b9 100644 --- a/xlators/features/marker/utils/syncdaemon/gsyncd.py +++ b/xlators/features/marker/utils/syncdaemon/gsyncd.py @@ -15,6 +15,7 @@ from errno import EEXIST, ENOENT from gconf import gconf from syncdutils import FreeObject, norm, grabpidfile, finalize, log_raise_exception +from syncdutils import GsyncdError from configinterface import GConffile import resource from monitor import monitor @@ -72,7 +73,7 @@ def startup(**kw): os.dup2(dn, f.fileno()) if getattr(gconf, 'pid_file', None): if not grabpidfile(gconf.pid_file + '.tmp'): - raise RuntimeError("cannot grap temporary pidfile") + raise GsyncdError("cannot grab temporary pidfile") os.rename(gconf.pid_file + '.tmp', gconf.pid_file) # wait for parent to terminate # so we can start up with @@ -203,7 +204,7 @@ def main_i(): if len(rscs) > 1: remote = rscs[1] if not local.can_connect_to(remote): - raise RuntimeError("%s cannot work with %s" % (local.path, remote and remote.path)) + raise GsyncdError("%s cannot work with %s" % (local.path, remote and remote.path)) pa = ([], [], []) urlprms = ({}, {'canonical': True}, {'canonical': True, 'escaped': True}) for x in rscs: @@ -237,7 +238,7 @@ def main_i(): else: sys.exit(1) elif not opt_ok: - raise RuntimeError("not a valid option: " + confdata.opt) + raise GsyncdError("not a valid option: " + confdata.opt) if confdata.op == 'get': gcnf.get(confdata.opt) elif confdata.op == 'set': @@ -263,7 +264,7 @@ def main_i(): # I have _never_ _ever_ seen such an utterly braindead # error condition if lvl2 == "Level " + lvl1: - raise RuntimeError('cannot recognize log level "%s"' % lvl0) + raise GsyncdError('cannot recognize log level "%s"' % lvl0) gconf.log_level = lvl2 go_daemon = rconf['go_daemon'] -- cgit