Incorrect usage of python-novaclient
This usage was causing an annoying error message. I've addressed it in a configurable way. There's a new config parameter that can be changed. Change-Id: I78832d0bb2ecdc49901b74d3811764a9676f7c8b Closes-Bug: #1493576
This commit is contained in:
parent
eac486f7eb
commit
ccb39eff61
|
@ -54,6 +54,8 @@ common_opts = [
|
|||
help='Service type to use when searching catalog.'),
|
||||
cfg.StrOpt('nova_compute_endpoint_type', default='publicURL',
|
||||
help='Service endpoint type to use when searching catalog.'),
|
||||
cfg.IntOpt('nova_client_version', default=2,
|
||||
help="The version of of the compute service client."),
|
||||
cfg.StrOpt('neutron_url', help='URL without the tenant segment.'),
|
||||
cfg.StrOpt('neutron_service_type', default='network',
|
||||
help='Service type to use when searching catalog.'),
|
||||
|
|
|
@ -22,7 +22,7 @@ from trove.common.strategies.cluster import strategy
|
|||
from cinderclient.v2 import client as CinderClient
|
||||
from heatclient.v1 import client as HeatClient
|
||||
from keystoneclient.service_catalog import ServiceCatalog
|
||||
from novaclient.v2.client import Client
|
||||
from novaclient.client import Client
|
||||
from swiftclient.client import Connection
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
@ -97,7 +97,7 @@ def nova_client(context):
|
|||
endpoint_region=CONF.os_region_name,
|
||||
endpoint_type=CONF.nova_compute_endpoint_type)
|
||||
|
||||
client = Client(context.user, context.auth_token,
|
||||
client = Client(CONF.nova_client_version, context.user, context.auth_token,
|
||||
bypass_url=url, tenant_id=context.tenant,
|
||||
auth_url=PROXY_AUTH_URL)
|
||||
client.client.auth_token = context.auth_token
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
import uuid
|
||||
|
||||
from mock import MagicMock, patch, ANY
|
||||
from novaclient.v2 import Client
|
||||
from novaclient.client import Client
|
||||
from novaclient.v2.flavors import FlavorManager, Flavor
|
||||
from novaclient.v2.servers import Server, ServerManager
|
||||
from oslo_config import cfg
|
||||
|
|
|
@ -634,7 +634,7 @@ class BuiltInstanceTasksTest(trove_testtools.TestCase):
|
|||
|
||||
self.instance_task._guest = MagicMock(spec=trove.guestagent.api.API)
|
||||
self.instance_task._nova_client = MagicMock(
|
||||
spec=novaclient.v2.Client)
|
||||
spec=novaclient.client)
|
||||
self.stub_server_mgr = MagicMock(
|
||||
spec=novaclient.v2.servers.ServerManager)
|
||||
self.stub_running_server = MagicMock(
|
||||
|
|
|
@ -38,6 +38,7 @@ from sqlalchemy import create_engine
|
|||
from troveclient.compat import Dbaas
|
||||
from troveclient.compat import exceptions
|
||||
|
||||
from trove.common import cfg
|
||||
from trove.common.utils import import_class
|
||||
from trove.common.utils import import_object
|
||||
from trove.tests.config import CONFIG as test_config
|
||||
|
@ -47,6 +48,7 @@ from trove.tests.util.users import Requirements
|
|||
|
||||
|
||||
WHITE_BOX = test_config.white_box
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
def assert_http_code(expected_http_code, func, *args, **kwargs):
|
||||
|
@ -162,10 +164,10 @@ def create_nova_client(user, service_type=None):
|
|||
if test_config.nova_client is None:
|
||||
raise SkipTest("No nova_client info specified in the Test Config "
|
||||
"so this test will be skipped.")
|
||||
from novaclient.v2.client import Client
|
||||
from novaclient.client import Client
|
||||
if not service_type:
|
||||
service_type = test_config.nova_client['nova_service_type']
|
||||
openstack = Client(user.auth_user, user.auth_key,
|
||||
openstack = Client(CONF.nova_client_version, user.auth_user, user.auth_key,
|
||||
user.tenant, test_config.nova_client['auth_url'],
|
||||
service_type=service_type, no_cache=True,
|
||||
cacert=test_config.values.get('cacert', None))
|
||||
|
|
Loading…
Reference in New Issue