Remove more python2 compat code
Remove code still adjusting for Python 2 behavior based on version checks. Change-Id: I29576a824278611d80991dce2501f14f1b262c76
This commit is contained in:
@@ -29,7 +29,6 @@ from keystoneauth1.identity import v2 as v2_auth
|
|||||||
from keystoneauth1.identity import v3 as v3_auth
|
from keystoneauth1.identity import v3 as v3_auth
|
||||||
from keystoneauth1 import loading
|
from keystoneauth1 import loading
|
||||||
from keystoneauth1 import session
|
from keystoneauth1 import session
|
||||||
from oslo_utils import encodeutils
|
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
import requests
|
import requests
|
||||||
from urllib import parse as urlparse
|
from urllib import parse as urlparse
|
||||||
@@ -1015,11 +1014,7 @@ class OpenStackHelpFormatter(argparse.HelpFormatter):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
if sys.version_info >= (3, 0):
|
OpenStackCinderShell().main(sys.argv[1:])
|
||||||
OpenStackCinderShell().main(sys.argv[1:])
|
|
||||||
else:
|
|
||||||
OpenStackCinderShell().main([encodeutils.safe_decode(item)
|
|
||||||
for item in sys.argv[1:]])
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("... terminating cinder client", file=sys.stderr)
|
print("... terminating cinder client", file=sys.stderr)
|
||||||
sys.exit(130)
|
sys.exit(130)
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
from urllib import parse
|
from urllib import parse
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
@@ -23,7 +22,6 @@ import prettytable
|
|||||||
import stevedore
|
import stevedore
|
||||||
|
|
||||||
from cinderclient import exceptions
|
from cinderclient import exceptions
|
||||||
from oslo_utils import encodeutils
|
|
||||||
|
|
||||||
|
|
||||||
def arg(*args, **kwargs):
|
def arg(*args, **kwargs):
|
||||||
@@ -109,10 +107,7 @@ def isunauthenticated(f):
|
|||||||
|
|
||||||
|
|
||||||
def _print(pt, order):
|
def _print(pt, order):
|
||||||
if sys.version_info >= (3, 0):
|
print(pt.get_string(sortby=order))
|
||||||
print(pt.get_string(sortby=order))
|
|
||||||
else:
|
|
||||||
print(encodeutils.safe_encode(pt.get_string(sortby=order)))
|
|
||||||
|
|
||||||
|
|
||||||
def print_list(objs, fields, exclude_unavailable=False, formatters=None,
|
def print_list(objs, fields, exclude_unavailable=False, formatters=None,
|
||||||
@@ -258,9 +253,6 @@ def find_resource(manager, name_or_id, **kwargs):
|
|||||||
except (ValueError, exceptions.NotFound):
|
except (ValueError, exceptions.NotFound):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if sys.version_info <= (3, 0):
|
|
||||||
name_or_id = encodeutils.safe_decode(name_or_id)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
resource = getattr(manager, 'resource_class', None)
|
resource = getattr(manager, 'resource_class', None)
|
||||||
|
Reference in New Issue
Block a user