From 470f824c6b5e71445bfe66cbd82b8fa00973bc1c Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 9 May 2014 14:23:52 -0500 Subject: [PATCH] Catch any Unicode errors that manage to sneak in Signed-off-by: Zack Cerza --- teuthology/orchestra/run.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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): -- 2.39.5