From c6504502edcda34c624af4f3c5e1765c664f408e Mon Sep 17 00:00:00 2001 From: junboli Date: Sat, 24 Jun 2017 11:57:25 +0800 Subject: [PATCH] Clean the redundant code in shell.py In the file cinderclient/shell.py, packages requests and six are double imported. This patch is to clean the redundant code. Change-Id: I4bade57753a50245df1b4b82c4a8708d3b0acdba --- cinderclient/shell.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/cinderclient/shell.py b/cinderclient/shell.py index d36294b84..f04dc7a0d 100644 --- a/cinderclient/shell.py +++ b/cinderclient/shell.py @@ -1,4 +1,3 @@ - # Copyright 2011-2014 OpenStack Foundation # All Rights Reserved. # @@ -25,15 +24,12 @@ import getpass import logging import sys -import requests -import six - from keystoneauth1 import discover -from keystoneauth1 import loading -from keystoneauth1 import session +from keystoneauth1 import exceptions from keystoneauth1.identity import v2 as v2_auth from keystoneauth1.identity import v3 as v3_auth -from keystoneauth1.exceptions import DiscoveryFailure +from keystoneauth1 import loading +from keystoneauth1 import session from oslo_utils import encodeutils from oslo_utils import importutils osprofiler_profiler = importutils.try_import("osprofiler.profiler") # noqa @@ -42,17 +38,16 @@ import six import six.moves.urllib.parse as urlparse import cinderclient +from cinderclient import _i18n +from cinderclient._i18n import _ from cinderclient import api_versions from cinderclient import client from cinderclient import exceptions as exc from cinderclient import utils -from cinderclient import _i18n -from cinderclient._i18n import _ - - # Enable i18n lazy translation _i18n.enable_lazy() + DEFAULT_MAJOR_OS_VOLUME_API_VERSION = "3" DEFAULT_CINDER_ENDPOINT_TYPE = 'publicURL' V1_SHELL = 'cinderclient.v1.shell' @@ -877,7 +872,7 @@ class OpenStackCinderShell(object): ks_discover = discover.Discover(session=session, url=auth_url) v2_auth_url = ks_discover.url_for('2.0') v3_auth_url = ks_discover.url_for('3.0') - except DiscoveryFailure: + except exceptions.DiscoveryFailure: # Discovery response mismatch. Raise the error raise except Exception: