From: Kyr Shatskyy Date: Fri, 21 Feb 2020 20:29:30 +0000 (+0100) Subject: qa/tasks: get rid of cStringIO for py3 X-Git-Tag: v15.1.1~129^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=99e9e82d646a9db1773ca97da7460dbfb5a0b415;p=ceph.git qa/tasks: get rid of cStringIO for py3 Signed-off-by: Kyr Shatskyy --- diff --git a/qa/tasks/watch_notify_same_primary.py b/qa/tasks/watch_notify_same_primary.py index 56bf98425f00..7160979119b3 100644 --- a/qa/tasks/watch_notify_same_primary.py +++ b/qa/tasks/watch_notify_same_primary.py @@ -2,7 +2,7 @@ """ watch_notify_same_primary task """ -from cStringIO import StringIO +from io import BytesIO import contextlib import logging @@ -68,8 +68,8 @@ def task(ctx, config): "watch", obj(n)], stdin=run.PIPE, - stdout=StringIO(), - stderr=StringIO(), + stdout=BytesIO(), + stderr=BytesIO(), wait=False) return proc @@ -81,14 +81,8 @@ def task(ctx, config): for i in range(num): with safe_while() as proceed: while proceed(): - proc = remote.run( - args = [ - "rados", - "-p", pool, - "listwatchers", - obj(i)], - stdout=StringIO()) - lines = proc.stdout.getvalue() + lines = remote.sh( + ["rados", "-p", pool, "listwatchers", obj(i)]) num_watchers = lines.count('watcher=') log.info('i see %d watchers for %s', num_watchers, obj(i)) if num_watchers >= 1: