diff --git a/bin/swift-dispersion-populate b/bin/swift-dispersion-populate index 946be0faa0..d051630cdb 100755 --- a/bin/swift-dispersion-populate +++ b/bin/swift-dispersion-populate @@ -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: