Merge "Migrate from keystoneclient to keystoneauth"

This commit is contained in:
Jenkins 2016-12-13 23:28:10 +00:00 committed by Gerrit Code Review
commit e80f5766a0
4 changed files with 13 additions and 13 deletions

View File

@ -17,11 +17,11 @@
import os import os
import six import six
from keystoneauth1 import exceptions
from keystoneauth1 import identity from keystoneauth1 import identity
from keystoneauth1.identity import v2
from keystoneauth1.identity import v3
from keystoneauth1 import session from keystoneauth1 import session
from keystoneclient.auth.identity import v2
from keystoneclient.auth.identity import v3
from keystoneclient import exceptions
from neutronclient.common import exceptions as nc_exceptions from neutronclient.common import exceptions as nc_exceptions
from neutronclient.v2_0 import client as neutron_client from neutronclient.v2_0 import client as neutron_client
from oslo_config import cfg from oslo_config import cfg

View File

@ -14,10 +14,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from keystoneclient.auth import identity from keystoneauth1 import exceptions
from keystoneauth1.identity import v3
from keystoneauth1 import session
from keystoneclient import client from keystoneclient import client
from keystoneclient import exceptions
from keystoneclient import session
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
@ -36,7 +36,7 @@ class Keystone(object):
def get_version(self, base_url=None): def get_version(self, base_url=None):
try: try:
keystone_client = client.Client(auth_url=base_url) keystone_client = client.Client(auth_url=base_url)
except exceptions.ConnectionRefused: except exceptions.ConnectionError:
raise raise
return keystone_client.version return keystone_client.version
@ -49,7 +49,7 @@ class Keystone(object):
def initialize_client(self, version, **kwargs): def initialize_client(self, version, **kwargs):
from keystoneclient.v3 import client from keystoneclient.v3 import client
auth_plugin = identity.v3.Password(**kwargs) auth_plugin = v3.Password(**kwargs)
ses = self.get_session(auth_plugin=auth_plugin) ses = self.get_session(auth_plugin=auth_plugin)
cli = client.Client(session=ses) cli = client.Client(session=ses)
return cli return cli

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from keystoneclient import exceptions from keystoneauth1 import exceptions
import mock import mock
from oslo_config import cfg from oslo_config import cfg

View File

@ -17,10 +17,10 @@
import os import os
from cryptography import fernet from cryptography import fernet
from keystoneclient.auth import identity from keystoneauth1 import exceptions
from keystoneauth1 import identity
from keystoneauth1 import session
from keystoneclient import client from keystoneclient import client
from keystoneclient import exceptions
from keystoneclient import session
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
@ -39,7 +39,7 @@ class Keystone(object):
def get_version(self, base_url=None): def get_version(self, base_url=None):
try: try:
keystone_client = client.Client(auth_url=base_url) keystone_client = client.Client(auth_url=base_url)
except exceptions.ConnectionRefused: except exceptions.ConnectionError:
raise raise
return keystone_client.version return keystone_client.version