Merge "Use public discover_extensions from novaclient"
This commit is contained in:
commit
10d0037531
@ -22,7 +22,6 @@ import string
|
||||
|
||||
from novaclient import client as nc
|
||||
from novaclient import exceptions
|
||||
from novaclient import shell as novashell
|
||||
from oslo_config import cfg
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import uuidutils
|
||||
@ -65,6 +64,14 @@ class NovaClientPlugin(client_plugin.ClientPlugin):
|
||||
management_url = self.url_for(service_type=self.service_types[0],
|
||||
endpoint_type=endpoint_type)
|
||||
|
||||
if hasattr(nc, 'discover_extensions'):
|
||||
extensions = nc.discover_extensions(NOVACLIENT_VERSION)
|
||||
else:
|
||||
# TODO(lyj): The else condition is for backward compatibility,
|
||||
# once novaclient bump to a newer version with
|
||||
# discover_extensions exists, this should be safely
|
||||
# removed.
|
||||
from novaclient import shell as novashell
|
||||
computeshell = novashell.OpenStackComputeShell()
|
||||
extensions = computeshell._discover_extensions(NOVACLIENT_VERSION)
|
||||
|
||||
|
@ -16,6 +16,7 @@ import collections
|
||||
import uuid
|
||||
|
||||
import mock
|
||||
from novaclient import client as nc
|
||||
from novaclient import exceptions as nova_exceptions
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
@ -44,6 +45,13 @@ class NovaClientPluginTests(NovaClientPluginTestCase):
|
||||
:module:'heat.engine.clients.os.nova'.
|
||||
"""
|
||||
|
||||
def test_create(self):
|
||||
self.nova_plugin._get_client_option = mock.MagicMock()
|
||||
self.nova_plugin.url_for = mock.MagicMock()
|
||||
nc.discover_extensions = mock.MagicMock()
|
||||
self.nova_plugin._create()
|
||||
nc.discover_extensions.assert_called_once_with('2')
|
||||
|
||||
def test_get_ip(self):
|
||||
my_image = mock.MagicMock()
|
||||
my_image.addresses = {
|
||||
|
Loading…
Reference in New Issue
Block a user