Merge "py3: fix swift-dispersion-populate" into stable/train

This commit is contained in:
Zuul 2019-10-15 22:56:42 +00:00 committed by Gerrit Code Review
commit ad84825549
1 changed files with 4 additions and 2 deletions

View File

@ -15,6 +15,7 @@
# limitations under the License.
from __future__ import print_function
import io
import traceback
from optparse import OptionParser
from sys import exit, stdout
@ -22,8 +23,8 @@ from time import time
from eventlet import GreenPool, patcher, sleep
from eventlet.pools import Pool
import six
from six.moves import range
from six.moves import cStringIO as StringIO
from six.moves.configparser import ConfigParser
try:
@ -56,7 +57,8 @@ def put_object(connpool, container, obj, report):
global retries_done
try:
with connpool.item() as conn:
conn.put_object(container, obj, StringIO(obj),
data = io.BytesIO(obj if six.PY2 else obj.encode('utf8'))
conn.put_object(container, obj, data,
headers={'x-object-meta-dispersion': obj})
retries_done += conn.attempts - 1
if report: