summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2018-02-22 22:48:55 +0000
committerTim Burke <tim.burke@gmail.com>2018-02-28 21:10:01 +0000
commit36c42974d6746a306002f8f8e1b3dae664c783d6 (patch)
treecf935e1a0037810c6e1d9520c1d1fc3c9a9640f8 /bin
parent624b5310b456e8bbf9cc729fe1d9a18aeb068ae1 (diff)
downloadswift-36c42974d6746a306002f8f8e1b3dae664c783d6.tar.gz
py3: Port more CLI tools
Bring under test - test/unit/cli/test_dispersion_report.py - test/unit/cli/test_info.py and - test/unit/cli/test_relinker.py I've verified that swift-*-info (at least) behave reasonably under py3, even swift-object-info when there's non-utf8 metadata on the data/meta file. Change-Id: Ifed4b8059337c395e56f5e9f8d939c34fe4ff8dd
Diffstat (limited to 'bin')
-rwxr-xr-xbin/swift-object-info8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/swift-object-info b/bin/swift-object-info
index fc8a13e4b..8e80b0eda 100755
--- a/bin/swift-object-info
+++ b/bin/swift-object-info
@@ -14,15 +14,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import codecs
import sys
from optparse import OptionParser
+import six
+
from swift.common.storage_policy import reload_storage_policies
from swift.common.utils import set_swift_dir
from swift.cli.info import print_obj, InfoSystemExit
if __name__ == '__main__':
+ if not six.PY2:
+ # Make stdout able to write escaped bytes
+ sys.stdout = codecs.getwriter("utf-8")(
+ sys.stdout.detach(), errors='surrogateescape')
+
parser = OptionParser('%prog [options] OBJECT_FILE')
parser.add_option(
'-n', '--no-check-etag', default=True,