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: v14.2.10~17^2~130 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2191fdc6b522cd807a8a02c0cba599ba32c239a5;p=ceph.git qa/tasks: get rid of cStringIO for py3 Signed-off-by: Kyr Shatskyy (cherry picked from commit 99e9e82d646a9db1773ca97da7460dbfb5a0b415) --- diff --git a/qa/tasks/watch_notify_same_primary.py b/qa/tasks/watch_notify_same_primary.py index b462e5e4d76e..3cb7eeb704ab 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 @@ -66,8 +66,8 @@ def task(ctx, config): "watch", obj(n)], stdin=run.PIPE, - stdout=StringIO(), - stderr=StringIO(), + stdout=BytesIO(), + stderr=BytesIO(), wait=False) return proc @@ -79,14 +79,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: