Remove _get_extensions method

Since novaclient 2.26 released and added to heat requirements,
this method no longer needed. Corresponding test was removed also.

Change-Id: I8297f4bfe066711b3f05b5cc69334c715ee637e9
This commit is contained in:
Oleksii Chuprykov 2015-08-18 13:34:32 +03:00
parent d988bf57c4
commit e78ac5142c
2 changed files with 1 additions and 28 deletions

View File

@ -60,23 +60,11 @@ class NovaClientPlugin(client_plugin.ClientPlugin):
service_types = [COMPUTE] = ['compute']
def _get_extensions(self):
if hasattr(nc, 'discover_extensions'):
return 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()
return computeshell._discover_extensions(NOVACLIENT_VERSION)
def _create(self):
endpoint_type = self._get_client_option('nova', 'endpoint_type')
management_url = self.url_for(service_type=self.COMPUTE,
endpoint_type=endpoint_type)
extensions = self._get_extensions()
extensions = nc.discover_extensions(NOVACLIENT_VERSION)
args = {
'project_id': self.context.tenant,

View File

@ -50,21 +50,6 @@ class NovaClientPluginTests(NovaClientPluginTestCase):
client = plugin.client()
self.assertIsNotNone(client.servers)
def test_get_extensions(self):
if hasattr(nova.nc, 'discover_extensions'):
# novaclient >= 2.24.0 has this function
# so we should test it
nova.nc.discover_extensions = mock.MagicMock()
self.nova_plugin._get_extensions()
nova.nc.discover_extensions.assert_called_once_with('2')
else:
# FIXME(kairat_kushaev) need to delete this leaf when novaclient
# version will be greater than 2.24.0
with mock.patch(
"nova.novashell.OpenStackComputeShell") as comp_shell:
self.nova_plugin._get_extensions()
comp_shell._discover_extensions.assert_called_once_with('2')
def test_get_ip(self):
my_image = mock.MagicMock()
my_image.addresses = {