diff options
| author | Csaba Henk <csaba@redhat.com> | 2012-05-22 14:03:32 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vijay@gluster.com> | 2012-07-08 21:14:31 -0700 | 
| commit | a091f75386fee1499553546e4e6849dabec77338 (patch) | |
| tree | b280cc51a21bd448924973ddeec67b608abf9468 | |
| parent | d98068a71b63330180281e09347c02d69213c2aa (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/3563
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
| -rw-r--r-- | xlators/features/marker/utils/syncdaemon/resource.py | 12 | 
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 de271bd39..9f4c5f744 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"""  | 
