summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorCsaba Henk <csaba@redhat.com>2012-05-22 14:03:32 +0530
committerAnand Avati <avati@redhat.com>2012-07-14 21:08:25 -0700
commitb69a5928718c8236a32d4a6eaec600a01d5fcd99 (patch)
treef7a2d0e7c5b1ffd8edffb992fba51cfe70153d93 /xlators
parentfb8efa4c6ab4bc1af49d05b0bc6b16eb188ea3b1 (diff)
geo-rep / gsyncd: sanitize error log of external commands
If a command invoked by gsyncd fails, gsyncd makes a log of what comes out on its stderr. So far the log indeterministically broke lines at random places. Now put some effort into reconstructing original lines and having a faithful log. BUG: 764678 Change-Id: I16fcc75d3e0f624c10c71d9b37c937ca677087cc Signed-off-by: Csaba Henk <csaba@redhat.com> Reviewed-on: http://review.gluster.com/3561 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/marker/utils/syncdaemon/resource.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/resource.py b/xlators/features/marker/utils/syncdaemon/resource.py
index 7e62fd48ca9..b9c757b60a1 100644
--- a/xlators/features/marker/utils/syncdaemon/resource.py
+++ b/xlators/features/marker/utils/syncdaemon/resource.py
@@ -188,9 +188,17 @@ class Popen(subprocess.Popen):
filling = ", saying:"
logging.error("""command "%s" returned with %s%s""" % \
(" ".join(self.args), repr(self.returncode), filling))
+ lp = ''
+ def logerr(l):
+ logging.error(self.args[0] + "> " + l)
for l in self.elines:
- for ll in l.rstrip().split("\n"):
- logging.error(self.args[0] + "> " + ll.rstrip())
+ ls = l.split('\n')
+ ls[0] = lp + ls[0]
+ lp = ls.pop()
+ for ll in ls:
+ logerr(ll)
+ if lp:
+ logerr(lp)
def errfail(self):
"""fail nicely if child did not terminate with success"""