Merge "py3: fix object-replicator rsync output parsing"

This commit is contained in:
Zuul 2019-08-15 04:51:03 +00:00 committed by Gerrit Code Review
commit a2a1ebe7a3
2 changed files with 4 additions and 2 deletions

View File

@ -394,7 +394,7 @@ class ObjectReplicator(Daemon):
return 1 # failure response code return 1 # failure response code
total_time = time.time() - start_time total_time = time.time() - start_time
for result in results.split('\n'): for result in results.decode('utf8').split('\n'):
if result == '': if result == '':
continue continue
if result.startswith('cd+'): if result.startswith('cd+'):

View File

@ -19,6 +19,7 @@ import os
import mock import mock
from gzip import GzipFile from gzip import GzipFile
from shutil import rmtree from shutil import rmtree
import six
import six.moves.cPickle as pickle import six.moves.cPickle as pickle
import time import time
import tempfile import tempfile
@ -124,7 +125,8 @@ def _mock_process(ret):
MockProcess.captured_log = captured_log MockProcess.captured_log = captured_log
orig_process = subprocess.Popen orig_process = subprocess.Popen
MockProcess.ret_code = (i[0] for i in ret) MockProcess.ret_code = (i[0] for i in ret)
MockProcess.ret_log = (i[1] for i in ret) MockProcess.ret_log = (i[1] if six.PY2 else i[1].encode('utf8')
for i in ret)
MockProcess.check_args = (i[2] for i in ret) MockProcess.check_args = (i[2] for i in ret)
object_replicator.subprocess.Popen = MockProcess object_replicator.subprocess.Popen = MockProcess
yield captured_log yield captured_log