"# noqa" cleanup
This patch set replaces a few method imports with module imports instead of "# noqa" comments. Fixes bug 1219676 Change-Id: I4d99ec5cda556669737c1eae2f528fbd35590d60
This commit is contained in:
@@ -26,7 +26,7 @@ from django.conf import settings # noqa
|
||||
from django.contrib.auth import logout # noqa
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
|
||||
from keystoneclient.exceptions import ClientException # noqa
|
||||
from keystoneclient import exceptions as keystone_exceptions
|
||||
|
||||
from openstack_auth import backend
|
||||
|
||||
@@ -315,8 +315,8 @@ def user_update(request, user, **data):
|
||||
error = None
|
||||
|
||||
if not keystone_can_edit_user():
|
||||
raise ClientException(405, _("Identity service does not allow "
|
||||
"editing user data."))
|
||||
raise keystone_exceptions.ClientException(405, _("Identity service "
|
||||
"does not allow editing user data."))
|
||||
|
||||
# The v2 API updates user model, password and default project separately
|
||||
if VERSIONS.active < 3:
|
||||
|
||||
@@ -16,19 +16,19 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from openstack_dashboard.api.neutron import NeutronAPIDictWrapper # noqa
|
||||
from openstack_dashboard.api.neutron import neutronclient # noqa
|
||||
from openstack_dashboard.api.neutron import subnet_get # noqa
|
||||
from openstack_dashboard.api import neutron
|
||||
|
||||
neutronclient = neutron.neutronclient
|
||||
|
||||
|
||||
class Vip(NeutronAPIDictWrapper):
|
||||
class Vip(neutron.NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron load balancer vip"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
super(Vip, self).__init__(apiresource)
|
||||
|
||||
|
||||
class Pool(NeutronAPIDictWrapper):
|
||||
class Pool(neutron.NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron load balancer pool"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
@@ -49,7 +49,7 @@ class Pool(NeutronAPIDictWrapper):
|
||||
'health_monitors': self.health_monitors}
|
||||
try:
|
||||
pFormatted['subnet_id'] = self.subnet_id
|
||||
pFormatted['subnet_name'] = subnet_get(
|
||||
pFormatted['subnet_name'] = neutron.subnet_get(
|
||||
request, self.subnet_id).cidr
|
||||
except Exception:
|
||||
pFormatted['subnet_id'] = self.subnet_id
|
||||
@@ -70,7 +70,7 @@ class Pool(NeutronAPIDictWrapper):
|
||||
return self.AttributeDict(pFormatted)
|
||||
|
||||
|
||||
class Member(NeutronAPIDictWrapper):
|
||||
class Member(neutron.NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron load balancer member"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
@@ -98,14 +98,14 @@ class Member(NeutronAPIDictWrapper):
|
||||
return self.AttributeDict(mFormatted)
|
||||
|
||||
|
||||
class PoolStats(NeutronAPIDictWrapper):
|
||||
class PoolStats(neutron.NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron load balancer pool stats"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
super(PoolStats, self).__init__(apiresource)
|
||||
|
||||
|
||||
class PoolMonitor(NeutronAPIDictWrapper):
|
||||
class PoolMonitor(neutron.NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron load balancer pool health monitor"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
|
||||
@@ -28,13 +28,12 @@ from django.conf import settings # noqa
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
|
||||
from novaclient.v1_1 import client as nova_client
|
||||
from novaclient.v1_1.contrib.list_extensions import ListExtManager # noqa
|
||||
from novaclient.v1_1.contrib import list_extensions as nova_list_extensions
|
||||
from novaclient.v1_1 import security_group_rules as nova_rules
|
||||
from novaclient.v1_1.security_groups import SecurityGroup as NovaSecurityGroup # noqa
|
||||
from novaclient.v1_1.servers import REBOOT_HARD # noqa
|
||||
from novaclient.v1_1.servers import REBOOT_SOFT # noqa
|
||||
from novaclient.v1_1 import security_groups as nova_security_groups
|
||||
from novaclient.v1_1 import servers as nova_servers
|
||||
|
||||
from horizon.conf import HORIZON_CONFIG # noqa
|
||||
from horizon import conf
|
||||
from horizon.utils.memoized import memoized # noqa
|
||||
|
||||
from openstack_dashboard.api import base
|
||||
@@ -233,8 +232,8 @@ class SecurityGroupManager(network_base.SecurityGroupManager):
|
||||
% instance_id)
|
||||
if body:
|
||||
# Wrap data in SG objects as novaclient would.
|
||||
sg_objs = [NovaSecurityGroup(nclient.security_groups, sg,
|
||||
loaded=True)
|
||||
sg_objs = [nova_security_groups.SecurityGroup(
|
||||
nclient.security_groups, sg, loaded=True)
|
||||
for sg in body.get('security_groups', [])]
|
||||
# Then wrap novaclient's object with our own. Yes, sadly wrapping
|
||||
# with two layers of objects is necessary.
|
||||
@@ -339,7 +338,7 @@ class FloatingIpManager(network_base.FloatingIpManager):
|
||||
return instance_id
|
||||
|
||||
def is_simple_associate_supported(self):
|
||||
return HORIZON_CONFIG["simple_ip_management"]
|
||||
return conf.HORIZON_CONFIG["simple_ip_management"]
|
||||
|
||||
|
||||
def novaclient(request):
|
||||
@@ -507,9 +506,9 @@ def server_resume(request, instance_id):
|
||||
|
||||
|
||||
def server_reboot(request, instance_id, soft_reboot=False):
|
||||
hardness = REBOOT_HARD
|
||||
hardness = nova_servers.REBOOT_HARD
|
||||
if soft_reboot:
|
||||
hardness = REBOOT_SOFT
|
||||
hardness = nova_servers.REBOOT_SOFT
|
||||
novaclient(request).servers.reboot(instance_id, hardness)
|
||||
|
||||
|
||||
@@ -644,7 +643,7 @@ def aggregate_list(request):
|
||||
|
||||
@memoized
|
||||
def list_extensions(request):
|
||||
return ListExtManager(novaclient(request)).show_all()
|
||||
return nova_list_extensions.ListExtManager(novaclient(request)).show_all()
|
||||
|
||||
|
||||
@memoized
|
||||
|
||||
@@ -5,7 +5,7 @@ from django.template import defaultfilters as filters
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
|
||||
from horizon import tables
|
||||
from horizon.utils.filters import parse_isotime # noqa
|
||||
from horizon.utils import filters as utils_filters
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@@ -110,7 +110,8 @@ class NovaServicesTable(tables.DataTable):
|
||||
state = tables.Column('state', verbose_name=_('State'))
|
||||
updated_at = tables.Column('updated_at',
|
||||
verbose_name=_('Updated At'),
|
||||
filters=(parse_isotime, filters.timesince))
|
||||
filters=(utils_filters.parse_isotime,
|
||||
filters.timesince))
|
||||
|
||||
def get_object_id(self, obj):
|
||||
return "%s-%s-%s" % (obj.binary, obj.host, obj.zone)
|
||||
|
||||
@@ -22,8 +22,7 @@ from horizon.workflows import views
|
||||
from mox import IsA # noqa
|
||||
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.dashboards.project.networks.tests \
|
||||
import form_data_subnet # noqa
|
||||
from openstack_dashboard.dashboards.project.networks import tests
|
||||
from openstack_dashboard.test import helpers as test
|
||||
|
||||
|
||||
@@ -408,7 +407,7 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
.AndReturn(subnet)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = form_data_subnet(subnet)
|
||||
form_data = tests.form_data_subnet(subnet)
|
||||
url = reverse('horizon:admin:networks:addsubnet',
|
||||
args=[subnet.network_id])
|
||||
res = self.client.post(url, form_data)
|
||||
@@ -428,7 +427,7 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = form_data_subnet(subnet, allocation_pools=[])
|
||||
form_data = tests.form_data_subnet(subnet, allocation_pools=[])
|
||||
url = reverse('horizon:admin:networks:addsubnet',
|
||||
args=[subnet.network_id])
|
||||
res = self.client.post(url, form_data)
|
||||
@@ -461,7 +460,7 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = form_data_subnet(subnet, allocation_pools=[])
|
||||
form_data = tests.form_data_subnet(subnet, allocation_pools=[])
|
||||
url = reverse('horizon:admin:networks:addsubnet',
|
||||
args=[subnet.network_id])
|
||||
res = self.client.post(url, form_data)
|
||||
@@ -481,7 +480,8 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
|
||||
# dummy IPv6 address
|
||||
cidr = '2001:0DB8:0:CD30:123:4567:89AB:CDEF/60'
|
||||
form_data = form_data_subnet(subnet, cidr=cidr, allocation_pools=[])
|
||||
form_data = tests.form_data_subnet(
|
||||
subnet, cidr=cidr, allocation_pools=[])
|
||||
url = reverse('horizon:admin:networks:addsubnet',
|
||||
args=[subnet.network_id])
|
||||
res = self.client.post(url, form_data)
|
||||
@@ -500,7 +500,7 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
|
||||
# dummy IPv6 address
|
||||
gateway_ip = '2001:0DB8:0:CD30:123:4567:89AB:CDEF'
|
||||
form_data = form_data_subnet(subnet, gateway_ip=gateway_ip,
|
||||
form_data = tests.form_data_subnet(subnet, gateway_ip=gateway_ip,
|
||||
allocation_pools=[])
|
||||
url = reverse('horizon:admin:networks:addsubnet',
|
||||
args=[subnet.network_id])
|
||||
@@ -523,7 +523,7 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
.AndReturn(subnet)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = form_data_subnet(subnet, allocation_pools=[])
|
||||
form_data = tests.form_data_subnet(subnet, allocation_pools=[])
|
||||
url = reverse('horizon:admin:networks:editsubnet',
|
||||
args=[subnet.network_id, subnet.id])
|
||||
res = self.client.post(url, form_data)
|
||||
@@ -542,7 +542,7 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
|
||||
# dummy IPv6 address
|
||||
gateway_ip = '2001:0DB8:0:CD30:123:4567:89AB:CDEF'
|
||||
form_data = form_data_subnet(subnet, gateway_ip=gateway_ip,
|
||||
form_data = tests.form_data_subnet(subnet, gateway_ip=gateway_ip,
|
||||
allocation_pools=[])
|
||||
url = reverse('horizon:admin:networks:editsubnet',
|
||||
args=[subnet.network_id, subnet.id])
|
||||
|
||||
@@ -23,7 +23,7 @@ from django.views.decorators.debug import sensitive_variables # noqa
|
||||
from horizon import exceptions
|
||||
from horizon import forms
|
||||
from horizon import messages
|
||||
from horizon.utils.fields import SelectWidget # noqa
|
||||
from horizon.utils import fields
|
||||
from horizon.utils import validators
|
||||
|
||||
from openstack_dashboard import api
|
||||
@@ -38,9 +38,9 @@ def _image_choice_title(img):
|
||||
class RebuildInstanceForm(forms.SelfHandlingForm):
|
||||
instance_id = forms.CharField(widget=forms.HiddenInput())
|
||||
image = forms.ChoiceField(label=_("Select Image"),
|
||||
widget=SelectWidget(attrs={'class': 'image-selector'},
|
||||
data_attrs=('size', 'display-name'),
|
||||
transform=_image_choice_title))
|
||||
widget=fields.SelectWidget(attrs={'class': 'image-selector'},
|
||||
data_attrs=('size', 'display-name'),
|
||||
transform=_image_choice_title))
|
||||
password = forms.RegexField(label=_("Rebuild Password"),
|
||||
required=False,
|
||||
widget=forms.PasswordInput(render_value=False),
|
||||
|
||||
@@ -22,36 +22,21 @@
|
||||
from django.conf.urls.defaults import patterns # noqa
|
||||
from django.conf.urls.defaults import url # noqa
|
||||
|
||||
from openstack_dashboard.dashboards.project.network_topology.views import\
|
||||
InstanceView # noqa
|
||||
from openstack_dashboard.dashboards.project.network_topology.views import\
|
||||
JSONView # noqa
|
||||
from openstack_dashboard.dashboards.project.network_topology.views import\
|
||||
NetworkTopologyView # noqa
|
||||
from openstack_dashboard.dashboards.project.network_topology.views import\
|
||||
NTCreateNetworkView # noqa
|
||||
from openstack_dashboard.dashboards.project.network_topology.views import\
|
||||
NTCreateRouterView # noqa
|
||||
from openstack_dashboard.dashboards.project.network_topology.views import\
|
||||
NTLaunchInstanceView # noqa
|
||||
from openstack_dashboard.dashboards.project.network_topology.views import\
|
||||
RouterDetailView # noqa
|
||||
from openstack_dashboard.dashboards.project.network_topology.views import\
|
||||
RouterView # noqa
|
||||
from openstack_dashboard.dashboards.project.network_topology import views
|
||||
|
||||
|
||||
urlpatterns = patterns(
|
||||
'openstack_dashboard.dashboards.project.network_topology.views',
|
||||
url(r'^$', NetworkTopologyView.as_view(), name='index'),
|
||||
url(r'^router$', RouterView.as_view(), name='router'),
|
||||
url(r'^instance$', InstanceView.as_view(), name='instance'),
|
||||
url(r'^router/(?P<router_id>[^/]+)/$', RouterDetailView.as_view(),
|
||||
url(r'^$', views.NetworkTopologyView.as_view(), name='index'),
|
||||
url(r'^router$', views.RouterView.as_view(), name='router'),
|
||||
url(r'^instance$', views.InstanceView.as_view(), name='instance'),
|
||||
url(r'^router/(?P<router_id>[^/]+)/$', views.RouterDetailView.as_view(),
|
||||
name='detail'),
|
||||
url(r'^json$', JSONView.as_view(), name='json'),
|
||||
url(r'^launchinstance$', NTLaunchInstanceView.as_view(),
|
||||
url(r'^json$', views.JSONView.as_view(), name='json'),
|
||||
url(r'^launchinstance$', views.NTLaunchInstanceView.as_view(),
|
||||
name='launchinstance'),
|
||||
url(r'^createnetwork$', NTCreateNetworkView.as_view(),
|
||||
url(r'^createnetwork$', views.NTCreateNetworkView.as_view(),
|
||||
name='createnetwork'),
|
||||
url(r'^createrouter$', NTCreateRouterView.as_view(),
|
||||
url(r'^createrouter$', views.NTCreateRouterView.as_view(),
|
||||
name='createrouter'),
|
||||
)
|
||||
|
||||
@@ -28,12 +28,12 @@ from django.views.generic import View # noqa
|
||||
|
||||
from openstack_dashboard import api
|
||||
|
||||
from openstack_dashboard.dashboards.project.network_topology.instances.tables\
|
||||
import InstancesTable # noqa
|
||||
from openstack_dashboard.dashboards.project.network_topology.ports.tables\
|
||||
import PortsTable # noqa
|
||||
from openstack_dashboard.dashboards.project.network_topology.routers.tables\
|
||||
import RoutersTable # noqa
|
||||
from openstack_dashboard.dashboards.project.network_topology.instances \
|
||||
import tables as instances_tables
|
||||
from openstack_dashboard.dashboards.project.network_topology.ports \
|
||||
import tables as ports_tables
|
||||
from openstack_dashboard.dashboards.project.network_topology.routers \
|
||||
import tables as routers_tables
|
||||
|
||||
from openstack_dashboard.dashboards.project.instances import\
|
||||
views as i_views
|
||||
@@ -73,17 +73,17 @@ class NTLaunchInstanceView (i_views.LaunchInstanceView):
|
||||
|
||||
|
||||
class InstanceView (i_views.IndexView):
|
||||
table_class = InstancesTable
|
||||
table_class = instances_tables.InstancesTable
|
||||
template_name = 'project/network_topology/iframe.html'
|
||||
|
||||
|
||||
class RouterView (r_views.IndexView):
|
||||
table_class = RoutersTable
|
||||
table_class = routers_tables.RoutersTable
|
||||
template_name = 'project/network_topology/iframe.html'
|
||||
|
||||
|
||||
class RouterDetailView (r_views.DetailView):
|
||||
table_classes = (PortsTable, )
|
||||
table_classes = (ports_tables.PortsTable, )
|
||||
template_name = 'project/network_topology/iframe.html'
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.test import helpers as test
|
||||
|
||||
from neutronclient.v2_0.client import Client as neutronclient # noqa
|
||||
from neutronclient.v2_0 import client
|
||||
|
||||
neutronclient = client.Client
|
||||
|
||||
|
||||
class LbaasApiTests(test.APITestCase):
|
||||
|
||||
@@ -21,7 +21,7 @@ import uuid
|
||||
from django import http
|
||||
from mox import IsA # noqa
|
||||
|
||||
from novaclient.v1_1.floating_ip_pools import FloatingIPPool # noqa
|
||||
from novaclient.v1_1 import floating_ip_pools
|
||||
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.test import helpers as test
|
||||
@@ -38,7 +38,8 @@ class NetworkApiNovaTestBase(test.APITestCase):
|
||||
class NetworkApiNovaFloatingIpTests(NetworkApiNovaTestBase):
|
||||
def test_floating_ip_pools_list(self):
|
||||
pool_names = ['pool1', 'pool2']
|
||||
pools = [FloatingIPPool(None, {'name': pool}) for pool in pool_names]
|
||||
pools = [floating_ip_pools.FloatingIPPool(
|
||||
None, {'name': pool}) for pool in pool_names]
|
||||
novaclient = self.stub_novaclient()
|
||||
novaclient.floating_ip_pools = self.mox.CreateMockAnything()
|
||||
novaclient.floating_ip_pools.list().AndReturn(pools)
|
||||
|
||||
@@ -22,20 +22,20 @@ from ceilometerclient.v2 import statistics
|
||||
from keystoneclient.v2_0 import tenants
|
||||
from keystoneclient.v2_0 import users
|
||||
|
||||
from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa
|
||||
from openstack_dashboard.test.test_data import utils
|
||||
|
||||
|
||||
def data(TEST):
|
||||
TEST.ceilometer_users = TestDataContainer()
|
||||
TEST.ceilometer_tenants = TestDataContainer()
|
||||
TEST.resources = TestDataContainer()
|
||||
TEST.samples = TestDataContainer()
|
||||
TEST.meters = TestDataContainer()
|
||||
TEST.statistics = TestDataContainer()
|
||||
TEST.global_disk_usages = TestDataContainer()
|
||||
TEST.global_network_usages = TestDataContainer()
|
||||
TEST.global_network_traffic_usages = TestDataContainer()
|
||||
TEST.global_object_store_usages = TestDataContainer()
|
||||
TEST.ceilometer_users = utils.TestDataContainer()
|
||||
TEST.ceilometer_tenants = utils.TestDataContainer()
|
||||
TEST.resources = utils.TestDataContainer()
|
||||
TEST.samples = utils.TestDataContainer()
|
||||
TEST.meters = utils.TestDataContainer()
|
||||
TEST.statistics = utils.TestDataContainer()
|
||||
TEST.global_disk_usages = utils.TestDataContainer()
|
||||
TEST.global_network_usages = utils.TestDataContainer()
|
||||
TEST.global_network_traffic_usages = utils.TestDataContainer()
|
||||
TEST.global_object_store_usages = utils.TestDataContainer()
|
||||
|
||||
# users
|
||||
ceilometer_user_dict1 = {'id': "1",
|
||||
|
||||
Reference in New Issue
Block a user