]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
copy_to_log(): Drop use of readlines() 947/head
authorZack Cerza <zack@redhat.com>
Thu, 1 Sep 2016 15:11:28 +0000 (09:11 -0600)
committerZack Cerza <zack@redhat.com>
Thu, 1 Sep 2016 15:15:12 +0000 (09:15 -0600)
http://tracker.ceph.com/issues/17102
Fixes: 17102
Calling readlines() on the source object causes the teuthology thread to
block on the remote command's execution. Instead, iterate over the
source object as advised at:
https://docs.python.org/2.7/library/stdtypes.html#file.xreadlines

This interface is also supported by StringIO and cStringIO.

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/orchestra/run.py

index 4754cb5ee5c15f787dce51d0cf62ab4f1d0ed4a9..43c9eb8ece702c9b66ef359bfa1f496f53f1dfa9 100644 (file)
@@ -237,14 +237,11 @@ def quote(args):
 
 
 def copy_to_log(f, logger, loglevel=logging.INFO):
-    """
-    Interface to older xreadlines api.
-    """
     # Work-around for http://tracker.ceph.com/issues/8313
     if isinstance(f, ChannelFile):
         f._flags += ChannelFile.FLAG_BINARY
 
-    for line in f.readlines():
+    for line in f:
         line = line.rstrip()
         # Second part of work-around for http://tracker.ceph.com/issues/8313
         try: