From: Zack Cerza Date: Fri, 9 May 2014 19:23:52 +0000 (-0500) Subject: Catch any Unicode errors that manage to sneak in X-Git-Tag: 1.1.0~1464 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=470f824c6b5e71445bfe66cbd82b8fa00973bc1c;p=teuthology.git Catch any Unicode errors that manage to sneak in Signed-off-by: Zack Cerza --- diff --git a/teuthology/orchestra/run.py b/teuthology/orchestra/run.py index 2fd8f25033..c899b1585a 100644 --- a/teuthology/orchestra/run.py +++ b/teuthology/orchestra/run.py @@ -137,8 +137,11 @@ def copy_to_log(f, logger, loglevel=logging.INFO): for line in f.xreadlines(): line = line.rstrip() # Second part of work-around for http://tracker.ceph.com/issues/8313 - line = unicode(line, 'utf-8', 'replace').encode('utf-8') - logger.log(loglevel, line) + try: + line = unicode(line, 'utf-8', 'replace').encode('utf-8') + logger.log(loglevel, line) + except (UnicodeDecodeError, UnicodeEncodeError): + logger.exception("Encountered unprintable line in command output") def copy_and_close(src, fdst):