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
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user