summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker/utils/syncdaemon/gsyncd.py
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-07-13 00:52:14 +0200
committerAnand Avati <avati@gluster.com>2011-07-29 05:24:43 -0700
commita13fbaca0512cae3853a2372d0d8237eb24dd225 (patch)
treeeb504ec3794346e1199b13ba88cf42c5815f28ea /xlators/features/marker/utils/syncdaemon/gsyncd.py
parent6c7a89321af50925fb53da378d996881a1907f31 (diff)
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 <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/features/marker/utils/syncdaemon/gsyncd.py')
-rw-r--r--xlators/features/marker/utils/syncdaemon/gsyncd.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/gsyncd.py b/xlators/features/marker/utils/syncdaemon/gsyncd.py
index 313bfdb0a..fb1dc1b9c 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']