Fix neutron-related openstack_dashboard imports

Hot Fix: In [0], floating IP and security group operations within
openstack_dashboard were moved. The imports are now corrected.

[0] https://review.openstack.org/#/c/466645/

Related-Blueprint: bp sahara-remove-nova-network
Change-Id: I2c086613fff302e852a2dda51701c620371a27e4
This commit is contained in:
Jeremy Freudberg 2017-06-06 09:58:06 -04:00
parent 29a350c9d4
commit 1c7c9e9251
5 changed files with 18 additions and 19 deletions

View File

@ -20,7 +20,6 @@ from horizon import exceptions
from horizon import tables
from horizon import tabs
from openstack_dashboard.api import glance
from openstack_dashboard.api import network
from openstack_dashboard.api import neutron
from openstack_dashboard.api import nova
@ -164,7 +163,7 @@ class NodeGroupsTab(tabs.Tab):
return {"cluster": cluster}
def _get_floating_ip_pool_name(self, request, pool_id):
pools = [pool for pool in network.floating_ip_pools_list(
pools = [pool for pool in neutron.floating_ip_pools_list(
request) if pool.id == pool_id]
return pools[0].name if pools else pool_id

View File

@ -17,7 +17,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
from openstack_dashboard.api import network
from openstack_dashboard.api import neutron
from openstack_dashboard.api import nova
from sahara_dashboard.api import sahara as saharaclient
@ -104,7 +104,7 @@ class GeneralTab(tabs.Tab):
"security_groups": security_groups}
def _get_floating_ip_pool_name(self, request, pool_id):
pools = [pool for pool in network.floating_ip_pools_list(
pools = [pool for pool in neutron.floating_ip_pools_list(
request) if pool.id == pool_id]
return pools[0].name if pools else pool_id

View File

@ -57,9 +57,9 @@ class DataProcessingNodeGroupTests(test.TestCase):
ngt.plugin_name,
ngt.hadoop_version) \
.MultipleTimes().AndReturn(configs)
dash_api.network.floating_ip_pools_list(IsA(http.HttpRequest)) \
dash_api.neutron.floating_ip_pools_list(IsA(http.HttpRequest)) \
.AndReturn([])
dash_api.network.security_group_list(IsA(http.HttpRequest)) \
dash_api.neutron.security_group_list(IsA(http.HttpRequest)) \
.AndReturn([])
self.mox.ReplayAll()
@ -122,7 +122,7 @@ class DataProcessingNodeGroupTests(test.TestCase):
'image_list'),
dash_api.nova: ('availability_zone_list',
'flavor_list'),
dash_api.network: ('floating_ip_pools_list',
dash_api.neutron: ('floating_ip_pools_list',
'security_group_list'),
dash_api.cinder: ('extension_supported',
'availability_zone_list',
@ -137,7 +137,7 @@ class DataProcessingNodeGroupTests(test.TestCase):
@test.create_stubs({api.sahara: ('client',
'nodegroup_template_create',
'plugin_get_version_details'),
dash_api.network: ('floating_ip_pools_list',
dash_api.neutron: ('floating_ip_pools_list',
'security_group_list'),
dash_api.nova: ('flavor_list',
'availability_zone_list'),
@ -166,9 +166,9 @@ class DataProcessingNodeGroupTests(test.TestCase):
ngt.plugin_name,
ngt.hadoop_version) \
.MultipleTimes().AndReturn(configs)
dash_api.network.floating_ip_pools_list(IsA(http.HttpRequest)) \
dash_api.neutron.floating_ip_pools_list(IsA(http.HttpRequest)) \
.AndReturn([])
dash_api.network.security_group_list(IsA(http.HttpRequest)) \
dash_api.neutron.security_group_list(IsA(http.HttpRequest)) \
.AndReturn([])
workflow_helpers.parse_configs_from_context(
IgnoreArg(), IgnoreArg()).AndReturn({})
@ -232,7 +232,7 @@ class DataProcessingNodeGroupTests(test.TestCase):
'nodegroup_template_update',
'nodegroup_template_get',
'plugin_get_version_details'),
dash_api.network: ('floating_ip_pools_list',
dash_api.neutron: ('floating_ip_pools_list',
'security_group_list'),
dash_api.nova: ('flavor_list',
'availability_zone_list'),
@ -264,9 +264,9 @@ class DataProcessingNodeGroupTests(test.TestCase):
ngt.plugin_name,
ngt.hadoop_version) \
.MultipleTimes().AndReturn(configs)
dash_api.network.floating_ip_pools_list(IsA(http.HttpRequest)) \
dash_api.neutron.floating_ip_pools_list(IsA(http.HttpRequest)) \
.AndReturn([])
dash_api.network.security_group_list(IsA(http.HttpRequest)) \
dash_api.neutron.security_group_list(IsA(http.HttpRequest)) \
.AndReturn([])
workflow_helpers.parse_configs_from_context(
IgnoreArg(), IgnoreArg()).AndReturn({})
@ -332,7 +332,7 @@ class DataProcessingNodeGroupTests(test.TestCase):
'image_list'),
dash_api.nova: ('availability_zone_list',
'flavor_list'),
dash_api.network: ('floating_ip_pools_list',
dash_api.neutron: ('floating_ip_pools_list',
'security_group_list'),
dash_api.cinder: ('extension_supported',
'availability_zone_list',

View File

@ -25,7 +25,7 @@ from horizon import exceptions
from horizon import forms
from horizon import workflows
from openstack_dashboard.api import cinder
from openstack_dashboard.api import network
from openstack_dashboard.api import neutron
from openstack_dashboard.dashboards.project.instances \
import utils as nova_utils
from openstack_dashboard.dashboards.project.volumes \
@ -155,7 +155,7 @@ class GeneralConfigAction(workflows.Action):
workflow_helpers.get_plugin_and_hadoop_version(request))
if not saharaclient.SAHARA_AUTO_IP_ALLOCATION_ENABLED:
pools = network.floating_ip_pools_list(request)
pools = neutron.floating_ip_pools_list(request)
pool_choices = [(pool.id, pool.name) for pool in pools]
pool_choices.insert(0, (None, "Do not assign floating IPs"))
@ -277,7 +277,7 @@ class SecurityConfigAction(workflows.Action):
initial=True)
try:
groups = network.security_group_list(request)
groups = neutron.security_group_list(request)
except Exception:
exceptions.handle(request,
_("Unable to get security group list."))

View File

@ -21,7 +21,7 @@ import six
from horizon import exceptions
from horizon import forms
from horizon import workflows
from openstack_dashboard.api import network
from openstack_dashboard.api import neutron
from sahara_dashboard.api import sahara as saharaclient
@ -190,7 +190,7 @@ def get_security_groups(request, security_group_ids):
security_groups = []
for group in security_group_ids or []:
try:
security_groups.append(network.security_group_get(
security_groups.append(neutron.security_group_get(
request, group))
except Exception:
LOG.info(_('Unable to retrieve security group %(group)s.') %