Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions common/lib/authentication.py

This file was deleted.

10 changes: 4 additions & 6 deletions common/lib/keystone_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,19 @@
# list the instances in the group id specified in the argument.
#

from keystoneauth1.identity import v3
from keystoneauth1 import session
from keystoneclient.v3 import client


class KeystoneClient(object):
"""
Keystone connection base class
"""

def __init__(self, auth):
def __init__(self, config):
"""
Constructor for creating a keystone object

:param config: `os_client_config.cloud_config.CloudConfig` object
"""
self.keystone = client.Client(session=auth.sess)
self.keystone = config.get_legacy_client('identity')

def project_list(self):
"""
Expand Down
9 changes: 4 additions & 5 deletions common/lib/nova_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
# group are violating the group's policy or not. It can be also used to
# list the instances in the group id specified in the argument.
#
from novaclient import client as nova_client
from keystoneclient.auth import identity
from keystoneclient import session
import os
from collections import Counter

Expand All @@ -26,11 +23,13 @@ class NovaClient(object):
Nova connection base class
"""

def __init__(self, auth):
def __init__(self, config):
"""
Constructor for creating a nova object

:param config: `os_client_config.cloud_config.CloudConfig` object
"""
self.nova = nova_client.Client('2', session=auth.sess)
self.nova = config.get_legacy_client('compute')

def nova_vm_list(self):
"""
Expand Down
14 changes: 11 additions & 3 deletions tools/antiaffinity_check/antiaffinity_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,17 @@ def setup_clients(self):
A method to seting up authentication and necessary clients for
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add "import os_client_config" on top?

the tool - Called by Constructor
"""
auth = Authentication()
self.novaclient = NovaClient(auth)
self.keystoneclient = KeystoneClient(auth)
# This dance can be slightly a bit better, but for now, let's just
# keep it operating like it was before. This will get a configuration
# based on envvars. If the user has a clouds.yaml file with more than
# one cloud defined, the user will need to define OS_CLOUD and maybe
# OS_REGION_NAME to indicate which one
config = os_client_config.OpenStackConfig()
cloud_config = config.get_one_cloud()
# As a further TODO - we should get rid of NovaClient and
# KeystoneClient altogether and add whatever they don't have to shade.
self.novaclient = NovaClient(cloud_config)
self.keystoneclient = KeystoneClient(cloud_config)

def create_table(self, fields):
"""
Expand Down