Fix E128 errors in openstack_dashboard/dashboards/admin/

E128 continuation line under-indented for visual indent

Partial-Bug: #1375929
Change-Id: I7a258d624f35b602da07c9b8604fb26c63287824
This commit is contained in:
Akihiro Motoki 2014-09-30 23:44:41 +09:00
parent 5dfca25190
commit 393642fd02
45 changed files with 217 additions and 165 deletions

View File

@ -70,9 +70,10 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests):
self.assertTemplateUsed(res, constants.AGGREGATES_CREATE_VIEW_TEMPLATE)
self.assertEqual(workflow.name, workflows.CreateAggregateWorkflow.name)
self.assertQuerysetEqual(workflow.steps,
['<SetAggregateInfoStep: set_aggregate_info>',
'<AddHostsToAggregateStep: add_host_to_aggregate>'])
self.assertQuerysetEqual(
workflow.steps,
['<SetAggregateInfoStep: set_aggregate_info>',
'<AddHostsToAggregateStep: add_host_to_aggregate>'])
@test.create_stubs({api.nova: ('host_list', 'aggregate_details_list',
'aggregate_create'), })
@ -95,8 +96,8 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests):
if not expected_error_message:
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res,
reverse(constants.AGGREGATES_INDEX_URL))
self.assertRedirectsNoFollow(
res, reverse(constants.AGGREGATES_INDEX_URL))
else:
self.assertFormErrors(res, error_count, expected_error_message)
@ -211,8 +212,8 @@ class AggregatesViewTests(test.BaseAdminViewTests):
if not expected_error_message:
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res,
reverse(constants.AGGREGATES_INDEX_URL))
self.assertRedirectsNoFollow(
res, reverse(constants.AGGREGATES_INDEX_URL))
else:
self.assertFormErrors(res, error_count, expected_error_message)

View File

@ -17,7 +17,8 @@ from openstack_dashboard.dashboards.admin.aggregates \
import views
urlpatterns = patterns('openstack_dashboard.dashboards.admin.aggregates.views',
urlpatterns = patterns(
'openstack_dashboard.dashboards.admin.aggregates.views',
url(r'^$',
views.IndexView.as_view(), name='index'),
url(r'^create/$',

View File

@ -18,7 +18,8 @@ from django.conf.urls import url
from openstack_dashboard.dashboards.admin.defaults import views
urlpatterns = patterns('openstack_dashboard.dashboards.admin.defaults.views',
urlpatterns = patterns(
'openstack_dashboard.dashboards.admin.defaults.views',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^update_defaults$',
views.UpdateDefaultQuotasView.as_view(), name='update_defaults'))

View File

@ -47,7 +47,8 @@ class UpdateDefaultQuotasAction(workflows.Action):
cores = forms.IntegerField(min_value=-1, label=_("VCPUs"))
security_groups = forms.IntegerField(min_value=-1,
label=_("Security Groups"))
gigabytes = forms.IntegerField(min_value=-1,
gigabytes = forms.IntegerField(
min_value=-1,
label=_("Total Size of Volumes and Snapshots (GB)"))
snapshots = forms.IntegerField(min_value=-1, label=_("Volume Snapshots"))
volumes = forms.IntegerField(min_value=-1, label=_("Volumes"))

View File

@ -89,9 +89,10 @@ class CreateFlavorWorkflowTests(BaseFlavorWorkflowTests):
workflow = res.context['workflow']
expected_name = workflows.CreateFlavor.name
self.assertEqual(res.context['workflow'].name, expected_name)
self.assertQuerysetEqual(workflow.steps,
['<CreateFlavorInfo: createflavorinfoaction>',
'<UpdateFlavorAccess: update_flavor_access>'])
self.assertQuerysetEqual(
workflow.steps,
['<CreateFlavorInfo: createflavorinfoaction>',
'<UpdateFlavorAccess: update_flavor_access>'])
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_list',
@ -288,9 +289,10 @@ class UpdateFlavorWorkflowTests(BaseFlavorWorkflowTests):
expected_name = workflows.UpdateFlavor.name
self.assertEqual(res.context['workflow'].name, expected_name)
self.assertQuerysetEqual(workflow.steps,
['<UpdateFlavorInfo: update_info>',
'<UpdateFlavorAccess: update_flavor_access>'])
self.assertQuerysetEqual(
workflow.steps,
['<UpdateFlavorInfo: update_info>',
'<UpdateFlavorAccess: update_flavor_access>'])
step = workflow.get_step("update_info")
eph = getattr(flavor, 'OS-FLV-EXT-DATA:ephemeral')
@ -405,13 +407,13 @@ class UpdateFlavorWorkflowTests(BaseFlavorWorkflowTests):
new_flavor = flavors.Flavor(flavors.FlavorManager(None),
{'id':
"cccccccc-cccc-cccc-cccc-cccccccccccc",
'name': flavor.name,
'vcpus': flavor.vcpus + 1,
'disk': flavor.disk,
'ram': flavor.ram,
'swap': flavor.swap,
'OS-FLV-EXT-DATA:ephemeral': eph,
'extra_specs': extra_specs})
'name': flavor.name,
'vcpus': flavor.vcpus + 1,
'disk': flavor.disk,
'ram': flavor.ram,
'swap': flavor.swap,
'OS-FLV-EXT-DATA:ephemeral': eph,
'extra_specs': extra_specs})
# GET/init, set up expected behavior
api.nova.flavor_get(IsA(http.HttpRequest), flavor.id) \
@ -658,13 +660,13 @@ class UpdateFlavorWorkflowTests(BaseFlavorWorkflowTests):
extra_specs = getattr(flavor_a, 'extra_specs')
new_flavor = flavors.Flavor(flavors.FlavorManager(None),
{'id': flavor_a.id,
'name': flavor_b.name,
'vcpus': flavor_a.vcpus,
'disk': flavor_a.disk,
'ram': flavor_a.ram,
'swap': flavor_a.swap,
'OS-FLV-EXT-DATA:ephemeral': eph,
'extra_specs': extra_specs})
'name': flavor_b.name,
'vcpus': flavor_a.vcpus,
'disk': flavor_a.disk,
'ram': flavor_a.ram,
'swap': flavor_a.swap,
'OS-FLV-EXT-DATA:ephemeral': eph,
'extra_specs': extra_specs})
# GET
api.nova.flavor_get(IsA(http.HttpRequest), flavor_a.id) \

View File

@ -22,7 +22,8 @@ from django.conf.urls import url
from openstack_dashboard.dashboards.admin.flavors import views
urlpatterns = patterns('openstack_dashboard.dashboards.admin.flavors.views',
urlpatterns = patterns(
'openstack_dashboard.dashboards.admin.flavors.views',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^create/$', views.CreateView.as_view(), name='create'),
url(r'^(?P<id>[^/]+)/update_metadata/$',

View File

@ -32,27 +32,27 @@ class CreateFlavorInfoAction(workflows.Action):
_flavor_id_help_text = _("Flavor ID should be UUID4 or integer. "
"Leave this field blank or use 'auto' to set "
"a random UUID4.")
name = forms.RegexField(label=_("Name"),
max_length=255,
regex=r'^[\w\.\- ]+$',
error_messages={'invalid': _('Name may only '
'contain letters, numbers, underscores, '
'periods and hyphens.')})
name = forms.RegexField(
label=_("Name"),
max_length=255,
regex=r'^[\w\.\- ]+$',
error_messages={'invalid': _('Name may only contain letters, numbers, '
'underscores, periods and hyphens.')})
flavor_id = forms.RegexField(label=_("ID"),
regex=_flavor_id_regex,
required=False,
initial='auto',
help_text=_flavor_id_help_text)
regex=_flavor_id_regex,
required=False,
initial='auto',
help_text=_flavor_id_help_text)
vcpus = forms.IntegerField(label=_("VCPUs"),
min_value=1)
min_value=1)
memory_mb = forms.IntegerField(label=_("RAM (MB)"),
min_value=1)
min_value=1)
disk_gb = forms.IntegerField(label=_("Root Disk (GB)"),
min_value=0)
min_value=0)
eph_gb = forms.IntegerField(label=_("Ephemeral Disk (GB)"),
min_value=0)
min_value=0)
swap_mb = forms.IntegerField(label=_("Swap Disk (MB)"),
min_value=0)
min_value=0)
class Meta:
name = _("Flavor Information")
@ -140,7 +140,8 @@ class UpdateFlavorAccessAction(workflows.MembershipAction):
flavor = api.nova.flavor_get(request, flavor_id)
if not flavor.is_public:
flavor_access = [project.tenant_id for project in
api.nova.flavor_access_list(request, flavor_id)]
api.nova.flavor_access_list(request,
flavor_id)]
except Exception:
exceptions.handle(request, err_msg)
@ -212,7 +213,8 @@ class CreateFlavor(workflows.Workflow):
api.nova.add_tenant_to_flavor(
request, flavor_id, project)
except Exception:
exceptions.handle(request,
exceptions.handle(
request,
_('Unable to set flavor access for project %s.') % project)
return True

View File

@ -25,11 +25,12 @@ class EvacuateHostForm(forms.SelfHandlingForm):
current_host = forms.CharField(label=_("Current Host"),
widget=forms.TextInput(
attrs={'readonly': 'readonly'}))
target_host = forms.ChoiceField(label=_("Target Host"),
help_text=_("Choose a Host to evacuate servers to."))
target_host = forms.ChoiceField(
label=_("Target Host"),
help_text=_("Choose a Host to evacuate servers to."))
on_shared_storage = forms.BooleanField(label=_("Shared Storage"),
initial=False, required=False)
initial=False, required=False)
def __init__(self, request, *args, **kwargs):
super(EvacuateHostForm, self).__init__(request, *args, **kwargs)

View File

@ -33,7 +33,7 @@ class HypervisorTab(tabs.TableTab):
hypervisors = nova.hypervisor_list(self.request)
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve hypervisor information.'))
_('Unable to retrieve hypervisor information.'))
return hypervisors

View File

@ -37,7 +37,7 @@ class AdminIndexView(tabs.TabbedTableView):
hypervisors.sort(key=utils.natural_sort('hypervisor_hostname'))
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve hypervisor information.'))
_('Unable to retrieve hypervisor information.'))
return hypervisors
@ -47,7 +47,7 @@ class AdminIndexView(tabs.TabbedTableView):
context["stats"] = api.nova.hypervisor_stats(self.request)
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve hypervisor statistics.'))
_('Unable to retrieve hypervisor statistics.'))
return context
@ -67,6 +67,7 @@ class AdminDetailView(tables.DataTableView):
except AttributeError:
pass
except Exception:
exceptions.handle(self.request,
exceptions.handle(
self.request,
_('Unable to retrieve hypervisor instances list.'))
return instances

View File

@ -100,17 +100,17 @@ class ImagesViewTest(test.BaseAdminViewTests):
self.assertEqual(len(res.context['images_table'].data),
settings.API_RESULT_PAGE_SIZE)
url = "?".join([reverse('horizon:admin:images:index'),
"=".join([tables.AdminImagesTable._meta.pagination_param,
images[2].id])])
params = "=".join([tables.AdminImagesTable._meta.pagination_param,
images[2].id])
url = "?".join([reverse('horizon:admin:images:index'), params])
res = self.client.get(url)
# get second page (items 2-4)
self.assertEqual(len(res.context['images_table'].data),
settings.API_RESULT_PAGE_SIZE)
url = "?".join([reverse('horizon:admin:images:index'),
"=".join([tables.AdminImagesTable._meta.pagination_param,
images[4].id])])
params = "=".join([tables.AdminImagesTable._meta.pagination_param,
images[4].id])
url = "?".join([reverse('horizon:admin:images:index'), params])
res = self.client.get(url)
# get third page (item 5)
self.assertEqual(len(res.context['images_table'].data),
@ -217,16 +217,16 @@ class ImagesViewTest(test.BaseAdminViewTests):
self.assertEqual(len(res.context['images_table'].data),
settings.API_RESULT_PAGE_SIZE)
url = "?".join([reverse('horizon:admin:images:index'),
"=".join([tables.AdminImagesTable._meta.pagination_param,
images[2].id])])
params = "=".join([tables.AdminImagesTable._meta.pagination_param,
images[2].id])
url = "?".join([reverse('horizon:admin:images:index'), params])
res = self.client.get(url)
# get second page (item 3)
self.assertEqual(len(res.context['images_table'].data), 1)
url = "?".join([reverse('horizon:admin:images:index'),
"=".join([tables.AdminImagesTable._meta.prev_pagination_param,
images[2].id])])
params = "=".join([tables.AdminImagesTable._meta.prev_pagination_param,
images[2].id])
url = "?".join([reverse('horizon:admin:images:index'), params])
res = self.client.get(url)
# prev back to get first page with 2 items
self.assertEqual(len(res.context['images_table'].data),

View File

@ -22,7 +22,8 @@ from django.conf.urls import url
from openstack_dashboard.dashboards.admin.images import views
urlpatterns = patterns('openstack_dashboard.dashboards.admin.images.views',
urlpatterns = patterns(
'openstack_dashboard.dashboards.admin.images.views',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^create/$', views.CreateView.as_view(), name='create'),
url(r'^(?P<image_id>[^/]+)/update/$',

View File

@ -146,14 +146,15 @@ class UpdateMetadataView(forms.ModalFormView):
try:
# metadefs_namespace_list() returns a tuple with list as 1st elem
available_namespaces = [x.namespace for x in
api.glance.metadefs_namespace_list(
self.request,
filters={"resource_types":
[resource_type]}
)[0]]
api.glance.metadefs_namespace_list(
self.request,
filters={"resource_types":
[resource_type]}
)[0]]
for namespace in available_namespaces:
details = api.glance.metadefs_namespace_get(self.request,
namespace, resource_type)
namespace,
resource_type)
# Filter out reserved custom properties from namespace
if reserved_props:
if hasattr(details, 'properties'):
@ -189,4 +190,4 @@ class UpdateMetadataView(forms.ModalFormView):
except Exception:
msg = _('Unable to retrieve the image to be updated.')
exceptions.handle(self.request, msg,
redirect=reverse('horizon:admin:images:index'))
redirect=reverse('horizon:admin:images:index'))

View File

@ -22,5 +22,6 @@ from django.conf.urls import url
from openstack_dashboard.dashboards.admin.info import views
urlpatterns = patterns('openstack_dashboard.dashboards.admin.info.views',
urlpatterns = patterns(
'openstack_dashboard.dashboards.admin.info.views',
url(r'^$', views.IndexView.as_view(), name='index'))

View File

@ -36,6 +36,6 @@ class IndexView(tabs.TabbedTableView):
context["version"] = version.version_info.version_string()
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve version information.'))
_('Unable to retrieve version information.'))
return context

View File

@ -25,7 +25,8 @@ from openstack_dashboard.dashboards.admin.instances import views
INSTANCES = r'^(?P<instance_id>[^/]+)/%s$'
urlpatterns = patterns('openstack_dashboard.dashboards.admin.instances.views',
urlpatterns = patterns(
'openstack_dashboard.dashboards.admin.instances.views',
url(r'^$', views.AdminIndexView.as_view(), name='index'),
url(INSTANCES % 'update', views.AdminUpdateView.as_view(), name='update'),
url(INSTANCES % 'detail', views.DetailView.as_view(), name='detail'),

View File

@ -35,14 +35,14 @@ class MeteringViewTests(test.APITestCase, test.BaseAdminViewTests):
# getting all resources and with statistics
res = self.client.get(reverse('horizon:admin:metering:index') +
"?tab=ceilometer_overview__stats")
"?tab=ceilometer_overview__stats")
self.assertTemplateUsed(res, 'admin/metering/index.html')
self.assertTemplateUsed(res, 'admin/metering/stats.html')
def test_report_page(self):
# getting report page with no api access
res = self.client.get(reverse('horizon:admin:metering:index') +
"?tab=ceilometer_overview__daily_report")
"?tab=ceilometer_overview__daily_report")
self.assertTemplateUsed(res, 'admin/metering/index.html')
self.assertTemplateUsed(res, 'admin/metering/daily.html')
@ -81,7 +81,8 @@ class MeteringViewTests(test.APITestCase, test.BaseAdminViewTests):
self.mox.ReplayAll()
# get all statistics of project aggregates
res = self.client.get(reverse('horizon:admin:metering:samples') +
res = self.client.get(
reverse('horizon:admin:metering:samples') +
"?meter=memory&group_by=project&stats_attr=avg&date_options=7")
self.assertEqual(res._headers['content-type'],
@ -112,7 +113,8 @@ class MeteringViewTests(test.APITestCase, test.BaseAdminViewTests):
self.mox.ReplayAll()
# get all statistics of project aggregates
res = self.client.get(reverse('horizon:admin:metering:samples') +
res = self.client.get(
reverse('horizon:admin:metering:samples') +
"?meter=memory&group_by=project&stats_attr=max&date_options=7")
self.assertEqual(res._headers['content-type'],
@ -141,7 +143,8 @@ class MeteringViewTests(test.APITestCase, test.BaseAdminViewTests):
# getting all resources and with statistics, I have only
# 'storage.objects' defined in test data
res = self.client.get(reverse('horizon:admin:metering:samples') +
res = self.client.get(
reverse('horizon:admin:metering:samples') +
"?meter=storage.objects&stats_attr=avg&date_options=7")
self.assertEqual(res._headers['content-type'],

View File

@ -15,7 +15,8 @@ from django.conf.urls import url
from openstack_dashboard.dashboards.admin.metering import views
urlpatterns = patterns('openstack_dashboard.dashboards.admin.metering.views',
urlpatterns = patterns(
'openstack_dashboard.dashboards.admin.metering.views',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^samples$', views.SamplesView.as_view(), name='samples'),
url(r'^report$', views.ReportView.as_view(), name='report'),

View File

@ -94,7 +94,7 @@ class SamplesView(django.views.generic.TemplateView):
ret['settings'] = {}
return HttpResponse(json.dumps(ret),
content_type='application/json')
content_type='application/json')
class ReportView(tables.MultiTableView):

View File

@ -32,7 +32,8 @@ class AddDHCPAgent(forms.SelfHandlingForm):
network_name = forms.CharField(label=_("Network Name"),
widget=forms.TextInput(
attrs={'readonly': 'readonly'}))
agent = forms.ChoiceField(label=_("New DHCP Agent"),
agent = forms.ChoiceField(
label=_("New DHCP Agent"),
help_text=_("Choose an DHCP Agent to attach to."))
def __init__(self, request, *args, **kwargs):

View File

@ -110,18 +110,19 @@ class CreateNetwork(forms.SelfHandlingForm):
'vxlan': seg_id_range.get('vxlan',
SEGMENTATION_ID_RANGE.get('vxlan'))
}
seg_id_help = (_("For VLAN networks, the VLAN VID on the physical "
"network that realizes the virtual network. Valid VLAN VIDs "
"are %(vlan_min)s through %(vlan_max)s. For GRE or VXLAN "
"networks, the tunnel ID. Valid tunnel IDs for GRE networks "
"are %(gre_min)s through %(gre_max)s. For VXLAN networks, "
"%(vxlan_min)s through %(vxlan_max)s.") % {
'vlan_min': self.seg_id_range['vlan'][0],
'vlan_max': self.seg_id_range['vlan'][1],
'gre_min': self.seg_id_range['gre'][0],
'gre_max': self.seg_id_range['gre'][1],
'vxlan_min': self.seg_id_range['vxlan'][0],
'vxlan_max': self.seg_id_range['vxlan'][1]})
seg_id_help = (
_("For VLAN networks, the VLAN VID on the physical "
"network that realizes the virtual network. Valid VLAN VIDs "
"are %(vlan_min)s through %(vlan_max)s. For GRE or VXLAN "
"networks, the tunnel ID. Valid tunnel IDs for GRE networks "
"are %(gre_min)s through %(gre_max)s. For VXLAN networks, "
"%(vxlan_min)s through %(vxlan_max)s.")
% {'vlan_min': self.seg_id_range['vlan'][0],
'vlan_max': self.seg_id_range['vlan'][1],
'gre_min': self.seg_id_range['gre'][0],
'gre_max': self.seg_id_range['gre'][1],
'vxlan_min': self.seg_id_range['vxlan'][0],
'vxlan_max': self.seg_id_range['vxlan'][1]})
self.fields['segmentation_id'].help_text = seg_id_help
supported_provider_types = neutron_settings.get(
@ -129,8 +130,9 @@ class CreateNetwork(forms.SelfHandlingForm):
if supported_provider_types == ['*']:
network_type_choices = PROVIDER_TYPES
else:
network_type_choices = [net_type for net_type in
PROVIDER_TYPES if net_type[0] in supported_provider_types]
network_type_choices = [
net_type for net_type in PROVIDER_TYPES
if net_type[0] in supported_provider_types]
if len(network_type_choices) == 0:
self._hide_provider_network_type()
else:

View File

@ -21,6 +21,7 @@ PORTS = r'^(?P<port_id>[^/]+)/%s$'
VIEW_MOD = 'openstack_dashboard.dashboards.admin.networks.ports.views'
urlpatterns = patterns(VIEW_MOD,
urlpatterns = patterns(
VIEW_MOD,
url(PORTS % 'detail', views.DetailView.as_view(), name='detail')
)

View File

@ -22,6 +22,7 @@ SUBNETS = r'^(?P<subnet_id>[^/]+)/%s$'
VIEW_MOD = 'openstack_dashboard.dashboards.admin.networks.subnets.views'
urlpatterns = patterns(VIEW_MOD,
urlpatterns = patterns(
VIEW_MOD,
url(SUBNETS % 'detail', views.DetailView.as_view(), name='detail')
)

View File

@ -103,9 +103,10 @@ class NetworksTable(tables.DataTable):
row_actions = (EditNetwork, DeleteNetwork)
def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs):
super(NetworksTable, self).__init__(request, data=data,
needs_form_wrapper=needs_form_wrapper,
**kwargs)
super(NetworksTable, self).__init__(
request, data=data,
needs_form_wrapper=needs_form_wrapper,
**kwargs)
if not api.neutron.is_extension_supported(request,
'dhcp_agent_scheduler'):
del self.columns['num_agents']

View File

@ -42,11 +42,13 @@ class NetworkTests(test.BaseAdminViewTests):
api.neutron.list_dhcp_agent_hosting_networks(IsA(http.HttpRequest),
network.id)\
.AndReturn(self.agents.list())
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(IsA(http.HttpRequest),
api.neutron.is_extension_supported(
IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(
IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
self.mox.ReplayAll()
res = self.client.get(INDEX_URL)
@ -60,8 +62,9 @@ class NetworkTests(test.BaseAdminViewTests):
def test_index_network_list_exception(self):
api.neutron.network_list(IsA(http.HttpRequest)) \
.AndRaise(self.exceptions.neutron)
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(
IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
self.mox.ReplayAll()
@ -101,10 +104,12 @@ class NetworkTests(test.BaseAdminViewTests):
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'mac-learning')\
.AndReturn(mac_learning)
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(
IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(
IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
self.mox.ReplayAll()
@ -186,10 +191,12 @@ class NetworkTests(test.BaseAdminViewTests):
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'mac-learning')\
.AndReturn(mac_learning)
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(
IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(
IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
self.mox.ReplayAll()
@ -478,8 +485,10 @@ class NetworkTests(test.BaseAdminViewTests):
res = self.client.get(url)
self.assertTemplateUsed(res, 'admin/networks/create.html')
self.assertContains(res, '<input type="hidden" name="network_type" '
'id="id_network_type" />', html=True)
self.assertContains(
res,
'<input type="hidden" name="network_type" id="id_network_type" />',
html=True)
@test.create_stubs({api.neutron: ('list_extensions',),
api.keystone: ('tenant_list',)})
@ -594,10 +603,12 @@ class NetworkTests(test.BaseAdminViewTests):
api.neutron.list_dhcp_agent_hosting_networks(IsA(http.HttpRequest),
network.id).\
AndReturn(self.agents.list())
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(
IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(
IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.keystone.tenant_list(IsA(http.HttpRequest))\
.AndReturn([tenants, False])
api.neutron.network_list(IsA(http.HttpRequest))\
@ -622,10 +633,12 @@ class NetworkTests(test.BaseAdminViewTests):
api.neutron.list_dhcp_agent_hosting_networks(IsA(http.HttpRequest),
network.id).\
AndReturn(self.agents.list())
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(
IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.neutron.is_extension_supported(
IsA(http.HttpRequest),
'dhcp_agent_scheduler').AndReturn(True)
api.keystone.tenant_list(IsA(http.HttpRequest))\
.AndReturn([tenants, False])
api.neutron.network_list(IsA(http.HttpRequest))\
@ -810,7 +823,7 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
# dummy IPv6 address
gateway_ip = '2001:0DB8:0:CD30:123:4567:89AB:CDEF'
form_data = tests.form_data_subnet(subnet, gateway_ip=gateway_ip,
allocation_pools=[])
allocation_pools=[])
url = reverse('horizon:admin:networks:addsubnet',
args=[subnet.network_id])
res = self.client.post(url, form_data)
@ -853,7 +866,7 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
# dummy IPv6 address
gateway_ip = '2001:0DB8:0:CD30:123:4567:89AB:CDEF'
form_data = tests.form_data_subnet(subnet, gateway_ip=gateway_ip,
allocation_pools=[])
allocation_pools=[])
url = reverse('horizon:admin:networks:editsubnet',
args=[subnet.network_id, subnet.id])
res = self.client.post(url, form_data)

View File

@ -32,7 +32,8 @@ from openstack_dashboard.dashboards.admin.networks import views
NETWORKS = r'^(?P<network_id>[^/]+)/%s$'
urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^create/$', views.CreateView.as_view(), name='create'),
url(NETWORKS % 'update', views.UpdateView.as_view(), name='update'),

View File

@ -23,6 +23,7 @@ from django.conf.urls import url
from openstack_dashboard.dashboards.admin.overview import views
urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^$', views.GlobalOverview.as_view(), name='index'),
)

View File

@ -19,5 +19,6 @@ from openstack_dashboard.dashboards.admin.routers.ports import views
PORTS = r'^(?P<port_id>[^/]+)/%s$'
urlpatterns = patterns('horizon.dashboards.admin.networks.ports.views',
urlpatterns = patterns(
'horizon.dashboards.admin.networks.ports.views',
url(PORTS % 'detail', views.DetailView.as_view(), name='detail'))

View File

@ -21,7 +21,8 @@ from openstack_dashboard.dashboards.admin.routers import views
ROUTER_URL = r'^(?P<router_id>[^/]+)/%s'
urlpatterns = patterns('horizon.dashboards.admin.routers.views',
urlpatterns = patterns(
'horizon.dashboards.admin.routers.views',
url(r'^$', views.IndexView.as_view(), name='index'),
url(ROUTER_URL % '$',
views.DetailView.as_view(),

View File

@ -41,7 +41,7 @@ class UpdateStatus(forms.SelfHandlingForm):
choices = dict(STATUS_CHOICES)
choice = choices[data['status']]
messages.success(request, _('Successfully updated volume snapshot'
' status: "%s".') % choice)
' status: "%s".') % choice)
return True
except Exception:
exceptions.handle(request,

View File

@ -31,7 +31,8 @@ class UpdateVolumeSnapshotStatus(tables.LinkAction):
classes = ("ajax-modal",)
icon = "pencil"
policy_rules = (("volume",
"snapshot_extension:snapshot_actions:update_snapshot_status"),)
"snapshot_extension:snapshot_actions:"
"update_snapshot_status"),)
class UpdateRow(tables.Row):
@ -41,9 +42,9 @@ class UpdateRow(tables.Row):
snapshot = cinder.volume_snapshot_get(request, snapshot_id)
snapshot._volume = cinder.volume_get(request, snapshot.volume_id)
snapshot.host_name = getattr(snapshot._volume,
'os-vol-host-attr:host')
'os-vol-host-attr:host')
tenant_id = getattr(snapshot._volume,
'os-vol-tenant-attr:tenant_id')
'os-vol-tenant-attr:tenant_id')
try:
tenant = keystone.tenant_get(request, tenant_id)
snapshot.tenant_name = getattr(tenant, "name")
@ -56,7 +57,7 @@ class UpdateRow(tables.Row):
class VolumeSnapshotsTable(volumes_tables.VolumesTableBase):
name = tables.Column("name", verbose_name=_("Name"),
link="horizon:admin:volumes:snapshots:detail")
link="horizon:admin:volumes:snapshots:detail")
volume_name = snapshots_tables.SnapshotVolumeNameColumn(
"name", verbose_name=_("Volume Name"),
link="horizon:admin:volumes:volumes:detail")
@ -68,8 +69,8 @@ class VolumeSnapshotsTable(volumes_tables.VolumesTableBase):
verbose_name = _("Volume Snapshots")
table_actions = (snapshots_tables.DeleteVolumeSnapshot,)
row_actions = (snapshots_tables.DeleteVolumeSnapshot,
UpdateVolumeSnapshotStatus,)
UpdateVolumeSnapshotStatus,)
row_class = UpdateRow
status_columns = ("status",)
columns = ('tenant', 'host', 'name', 'description', 'size', 'status',
'volume_name',)
'volume_name',)

View File

@ -16,7 +16,8 @@ from django.conf.urls import url
from openstack_dashboard.dashboards.admin.volumes.snapshots import views
urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^(?P<snapshot_id>[^/]+)$',
views.DetailView.as_view(),
name='detail'),

View File

@ -98,9 +98,11 @@ class SnapshotTab(tabs.TableTab):
def get_volume_snapshots_data(self):
if api.base.is_service_enabled(self.request, 'volume'):
try:
snapshots = cinder.volume_snapshot_list(self.request,
snapshots = cinder.volume_snapshot_list(
self.request,
search_opts={'all_tenants': True})
volumes = cinder.volume_list(self.request,
volumes = cinder.volume_list(
self.request,
search_opts={'all_tenants': True})
volumes = dict((v.id, v) for v in volumes)
except Exception:
@ -121,7 +123,7 @@ class SnapshotTab(tabs.TableTab):
for snapshot in snapshots:
volume = volumes.get(snapshot.volume_id)
tenant_id = getattr(volume,
'os-vol-tenant-attr:tenant_id', None)
'os-vol-tenant-attr:tenant_id', None)
tenant = tenant_dict.get(tenant_id, None)
snapshot._volume = volume
snapshot.tenant_name = getattr(tenant, "name", None)

View File

@ -56,7 +56,7 @@ class VolumeTests(test.BaseAdminViewTests):
res = self.client.post(
reverse('horizon:admin:volumes:volumes:update_status',
args=(volume.id,)),
args=(volume.id,)),
formData)
self.assertNoFormErrors(res)
@ -74,8 +74,8 @@ class VolumeTests(test.BaseAdminViewTests):
'horizon:admin:volumes:volume_types_tab'))
self.assertEqual(res.status_code, 200)
self.assertTemplateUsed(res,
'admin/volumes/volume_types/volume_types_tables.html')
self.assertTemplateUsed(
res, 'admin/volumes/volume_types/volume_types_tables.html')
volume_types = res.context['volume_types_table'].data
self.assertItemsEqual(volume_types, self.volume_types.list())
qos_specs = res.context['qos_specs_table'].data

View File

@ -22,7 +22,8 @@ from openstack_dashboard.dashboards.admin.volumes.volume_types \
from openstack_dashboard.dashboards.admin.volumes.volumes \
import urls as volumes_urls
urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^$',
views.IndexView.as_view(),
name='index'),

View File

@ -16,7 +16,8 @@ from django.conf.urls import url
from openstack_dashboard.dashboards.admin.volumes.volume_types.extras \
import views
urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^create/$', views.CreateView.as_view(), name='create'),
url(r'^(?P<key>[^/]+)/edit/$', views.EditView.as_view(), name='edit')

View File

@ -29,8 +29,8 @@ class ExtraSpecMixin(object):
def get_context_data(self, **kwargs):
context = super(ExtraSpecMixin, self).get_context_data(**kwargs)
try:
context['vol_type'] = api.cinder.volume_type_get(self.request,
self.kwargs['type_id'])
context['vol_type'] = api.cinder.volume_type_get(
self.request, self.kwargs['type_id'])
except Exception:
exceptions.handle(self.request,
_("Unable to retrieve volume type details."))

View File

@ -69,7 +69,7 @@ class ManageQosSpecAssociation(forms.SelfHandlingForm):
if found_error:
raise forms.ValidationError(
_('New associated QoS Spec must be different than '
'the current associated QoS Spec.'))
'the current associated QoS Spec.'))
return cleaned_new_spec_id
def handle(self, request, data):
@ -129,7 +129,7 @@ class EditQosSpecConsumer(forms.SelfHandlingForm):
if cleaned_new_consumer == old_consumer:
raise forms.ValidationError(
_('QoS Spec consumer value must be different than '
'the current consumer value.'))
'the current consumer value.'))
return cleaned_new_consumer
def handle(self, request, data):

View File

@ -35,8 +35,8 @@ class QosSpecsTests(test.BaseAdminViewTests):
res = self.client.get(index_url)
self.assertTemplateUsed(res,
'admin/volumes/volume_types/qos_specs/index.html')
self.assertTemplateUsed(
res, 'admin/volumes/volume_types/qos_specs/index.html')
rows = res.context['table'].get_rows()
specs = self.cinder_qos_specs.first().specs
for row in rows:
@ -77,7 +77,7 @@ class QosSpecsTests(test.BaseAdminViewTests):
api.cinder.qos_spec_list(IsA(http.HttpRequest)).\
AndReturn(self.cinder_qos_specs.list())
api.cinder.qos_spec_delete(IsA(http.HttpRequest),
str(qos_spec.id))
str(qos_spec.id))
self.mox.ReplayAll()
res = self.client.post(

View File

@ -16,7 +16,8 @@ from django.conf.urls import url
from openstack_dashboard.dashboards.admin.volumes.volume_types.qos_specs \
import views
urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^(?P<qos_spec_id>[^/]+)/create/$',
views.CreateKeyValuePairView.as_view(), name='create'),
url(r'^(?P<qos_spec_id>[^/]+)/$', views.IndexView.as_view(), name='index'),

View File

@ -23,7 +23,8 @@ from openstack_dashboard.dashboards.admin.volumes.volume_types \
VIEWS_MOD = ('openstack_dashboard.dashboards.admin.volumes.volume_types.views')
urlpatterns = patterns('VIEWS_MOD',
urlpatterns = patterns(
'VIEWS_MOD',
url(r'^create_type$', views.CreateVolumeTypeView.as_view(),
name='create_type'),
url(r'^create_qos_spec$', views.CreateQosSpecView.as_view(),

View File

@ -126,8 +126,9 @@ class ManageQosSpecAssociationView(forms.ModalFormView):
return qos_spec
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve QoS Spec association.'))
exceptions.handle(
self.request,
_('Unable to retrieve QoS Spec association.'))
return None

View File

@ -80,7 +80,7 @@ class UpdateStatus(forms.SelfHandlingForm):
except Exception:
exceptions.handle(request,
_('Unable to update volume status to "%s".') %
new_status)
new_status)
return False

View File

@ -33,7 +33,7 @@ class UpdateVolumeStatusAction(tables.LinkAction):
classes = ("ajax-modal",)
icon = "pencil"
policy_rules = (("volume",
"volume_extension:volume_admin_actions:reset_status"),)
"volume_extension:volume_admin_actions:reset_status"),)
class VolumesTable(volumes_tables.VolumesTable):

View File

@ -18,7 +18,8 @@ from openstack_dashboard.dashboards.admin.volumes.volumes \
VIEWS_MOD = ('openstack_dashboard.dashboards.admin.volumes.volumes.views')
urlpatterns = patterns(VIEWS_MOD,
urlpatterns = patterns(
VIEWS_MOD,
url(r'^(?P<volume_id>[^/]+)/$', views.DetailView.as_view(),
name='detail'),
url(r'^(?P<volume_id>[^/]+)/update_status$',