Skip to content

Commit c650450

Browse files
author
junboli
committed
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
1 parent b910f5b commit c650450

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

cinderclient/shell.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Copyright 2011-2014 OpenStack Foundation
32
# All Rights Reserved.
43
#
@@ -25,15 +24,12 @@
2524
import logging
2625
import sys
2726

28-
import requests
29-
import six
30-
3127
from keystoneauth1 import discover
32-
from keystoneauth1 import loading
33-
from keystoneauth1 import session
28+
from keystoneauth1 import exceptions
3429
from keystoneauth1.identity import v2 as v2_auth
3530
from keystoneauth1.identity import v3 as v3_auth
36-
from keystoneauth1.exceptions import DiscoveryFailure
31+
from keystoneauth1 import loading
32+
from keystoneauth1 import session
3733
from oslo_utils import encodeutils
3834
from oslo_utils import importutils
3935
osprofiler_profiler = importutils.try_import("osprofiler.profiler") # noqa
@@ -42,17 +38,16 @@
4238
import six.moves.urllib.parse as urlparse
4339

4440
import cinderclient
41+
from cinderclient import _i18n
42+
from cinderclient._i18n import _
4543
from cinderclient import api_versions
4644
from cinderclient import client
4745
from cinderclient import exceptions as exc
4846
from cinderclient import utils
49-
from cinderclient import _i18n
50-
from cinderclient._i18n import _
51-
52-
5347
# Enable i18n lazy translation
5448
_i18n.enable_lazy()
5549

50+
5651
DEFAULT_MAJOR_OS_VOLUME_API_VERSION = "3"
5752
DEFAULT_CINDER_ENDPOINT_TYPE = 'publicURL'
5853
V1_SHELL = 'cinderclient.v1.shell'
@@ -877,7 +872,7 @@ def _discover_auth_versions(self, session, auth_url):
877872
ks_discover = discover.Discover(session=session, url=auth_url)
878873
v2_auth_url = ks_discover.url_for('2.0')
879874
v3_auth_url = ks_discover.url_for('3.0')
880-
except DiscoveryFailure:
875+
except exceptions.DiscoveryFailure:
881876
# Discovery response mismatch. Raise the error
882877
raise
883878
except Exception:

0 commit comments

Comments
 (0)