From f99981fc9cdd8b0001823bb709e22520848c575f Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Tue, 30 Sep 2014 22:22:55 +0900 Subject: [PATCH] Fix E127 errors in openstack_dashboard/dashboards/project/ E127 continuation line over-indented for visual indent Partial-Bug: #1375931 Change-Id: Ia62781d24f13407ca600743b167392dddf6c271d --- .../access_and_security/floating_ips/tests.py | 20 +- .../access_and_security/keypairs/forms.py | 5 +- .../access_and_security/keypairs/tests.py | 10 +- .../access_and_security/keypairs/urls.py | 6 +- .../access_and_security/keypairs/views.py | 4 +- .../security_groups/forms.py | 24 +- .../security_groups/tests.py | 14 +- .../project/access_and_security/tests.py | 4 +- .../dashboards/project/containers/urls.py | 8 +- .../clusters/workflows/create.py | 4 +- .../project/database_backups/views.py | 4 +- .../dashboards/project/databases/tests.py | 4 +- .../dashboards/project/firewalls/views.py | 2 +- .../dashboards/project/images/images/tests.py | 19 +- .../project/images/snapshots/tests.py | 2 +- .../dashboards/project/images/tests.py | 22 +- .../dashboards/project/instances/forms.py | 4 +- .../dashboards/project/instances/tests.py | 425 +++++++++--------- .../dashboards/project/instances/views.py | 2 +- .../instances/workflows/create_instance.py | 14 +- .../dashboards/project/loadbalancers/forms.py | 12 +- .../dashboards/project/loadbalancers/views.py | 2 +- .../project/networks/subnets/workflows.py | 16 +- .../dashboards/project/networks/tests.py | 4 +- .../dashboards/project/networks/workflows.py | 22 +- .../dashboards/project/overview/tests.py | 30 +- .../routers/extensions/routerrules/tabs.py | 8 +- .../dashboards/project/routers/tests.py | 4 +- .../dashboards/project/stacks/tests.py | 96 ++-- .../project/volumes/backups/tables.py | 2 +- .../project/volumes/backups/tests.py | 2 +- .../project/volumes/volumes/forms.py | 48 +- .../project/volumes/volumes/tables.py | 6 +- .../project/volumes/volumes/tests.py | 150 +++---- 34 files changed, 497 insertions(+), 502 deletions(-) diff --git a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tests.py b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tests.py index 4ff1efa79b..c3faf6dd81 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tests.py +++ b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tests.py @@ -82,9 +82,9 @@ class FloatingIpViewTests(test.TestCase): server = self.servers.first() api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ - .AndReturn(self.floating_ips.list()) + .AndReturn(self.floating_ips.list()) api.network.floating_ip_target_list(IsA(http.HttpRequest)) \ - .AndReturn(self.servers.list()) + .AndReturn(self.servers.list()) api.network.floating_ip_associate(IsA(http.HttpRequest), floating_ip.id, server.id) @@ -104,9 +104,9 @@ class FloatingIpViewTests(test.TestCase): server = self.servers.first() api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ - .AndReturn(self.floating_ips.list()) + .AndReturn(self.floating_ips.list()) api.network.floating_ip_target_list(IsA(http.HttpRequest)) \ - .AndReturn(self.servers.list()) + .AndReturn(self.servers.list()) api.network.floating_ip_associate(IsA(http.HttpRequest), floating_ip.id, server.id) @@ -127,13 +127,13 @@ class FloatingIpViewTests(test.TestCase): server = self.servers.first() api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ - .AndReturn(self.floating_ips.list()) + .AndReturn(self.floating_ips.list()) api.network.floating_ip_target_list(IsA(http.HttpRequest)) \ - .AndReturn(self.servers.list()) + .AndReturn(self.servers.list()) api.network.floating_ip_associate(IsA(http.HttpRequest), floating_ip.id, server.id) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) self.mox.ReplayAll() form_data = {'instance_id': server.id, @@ -152,11 +152,11 @@ class FloatingIpViewTests(test.TestCase): server = self.servers.first() api.nova.server_list(IsA(http.HttpRequest)) \ - .AndReturn([self.servers.list(), False]) + .AndReturn([self.servers.list(), False]) api.network.floating_ip_supported(IsA(http.HttpRequest)) \ .AndReturn(True) api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ - .AndReturn(self.floating_ips.list()) + .AndReturn(self.floating_ips.list()) api.network.floating_ip_disassociate(IsA(http.HttpRequest), floating_ip.id, server.id) @@ -177,7 +177,7 @@ class FloatingIpViewTests(test.TestCase): server = self.servers.first() api.nova.server_list(IsA(http.HttpRequest)) \ - .AndReturn([self.servers.list(), False]) + .AndReturn([self.servers.list(), False]) api.network.floating_ip_supported(IsA(http.HttpRequest)) \ .AndReturn(True) api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ diff --git a/openstack_dashboard/dashboards/project/access_and_security/keypairs/forms.py b/openstack_dashboard/dashboards/project/access_and_security/keypairs/forms.py index e8afa28600..2b86d611d7 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/keypairs/forms.py +++ b/openstack_dashboard/dashboards/project/access_and_security/keypairs/forms.py @@ -61,8 +61,9 @@ class ImportKeypair(forms.SelfHandlingForm): keypair = api.nova.keypair_import(request, data['name'], data['public_key']) - messages.success(request, _('Successfully imported public key: %s') - % data['name']) + messages.success(request, + _('Successfully imported public key: %s') + % data['name']) return keypair except Exception: exceptions.handle(request, ignore=True) diff --git a/openstack_dashboard/dashboards/project/access_and_security/keypairs/tests.py b/openstack_dashboard/dashboards/project/access_and_security/keypairs/tests.py index fd1c46faeb..e9ca0ec7c1 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/keypairs/tests.py +++ b/openstack_dashboard/dashboards/project/access_and_security/keypairs/tests.py @@ -42,7 +42,7 @@ class KeyPairViewTests(test.TestCase): api.network.floating_ip_supported(IsA(http.HttpRequest)) \ .AndReturn(True) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn(self.keypairs.list()) + .AndReturn(self.keypairs.list()) api.nova.keypair_delete(IsA(http.HttpRequest), keypair.name) self.mox.ReplayAll() @@ -60,9 +60,9 @@ class KeyPairViewTests(test.TestCase): api.network.floating_ip_supported(IsA(http.HttpRequest)) \ .AndReturn(True) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn(self.keypairs.list()) + .AndReturn(self.keypairs.list()) api.nova.keypair_delete(IsA(http.HttpRequest), keypair.name) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) self.mox.ReplayAll() formData = {'action': 'keypairs__delete__%s' % keypair.name} @@ -139,7 +139,7 @@ class KeyPairViewTests(test.TestCase): public_key = "ABCDEF" api.nova.keypair_import(IsA(http.HttpRequest), key_name, public_key) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) self.mox.ReplayAll() formData = {'method': 'ImportKeypair', @@ -169,7 +169,7 @@ class KeyPairViewTests(test.TestCase): keypair = self.keypairs.first() api.nova.keypair_create(IsA(http.HttpRequest), keypair.name) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) self.mox.ReplayAll() context = {'keypair_name': keypair.name} diff --git a/openstack_dashboard/dashboards/project/access_and_security/keypairs/urls.py b/openstack_dashboard/dashboards/project/access_and_security/keypairs/urls.py index 646f2e228b..35b55bc94f 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/keypairs/urls.py +++ b/openstack_dashboard/dashboards/project/access_and_security/keypairs/urls.py @@ -27,9 +27,9 @@ urlpatterns = patterns('', url(r'^create/$', views.CreateView.as_view(), name='create'), url(r'^import/$', views.ImportView.as_view(), name='import'), url(r'^(?P[^/]+)/download/$', views.DownloadView.as_view(), - name='download'), + name='download'), url(r'^(?P[^/]+)/generate/$', views.GenerateView.as_view(), - name='generate'), + name='generate'), url(r'^(?P[^/]+)/(?P[^/]+)/generate/$', - views.GenerateView.as_view(), name='generate'), + views.GenerateView.as_view(), name='generate'), ) diff --git a/openstack_dashboard/dashboards/project/access_and_security/keypairs/views.py b/openstack_dashboard/dashboards/project/access_and_security/keypairs/views.py index 94f065806f..19aaeb5d1b 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/keypairs/views.py +++ b/openstack_dashboard/dashboards/project/access_and_security/keypairs/views.py @@ -75,8 +75,8 @@ class GenerateView(View): redirect=redirect) response = http.HttpResponse(content_type='application/binary') - response['Content-Disposition'] = \ - 'attachment; filename=%s.pem' % slugify(keypair.name) + response['Content-Disposition'] = ('attachment; filename=%s.pem' + % slugify(keypair.name)) response.write(keypair.private_key) response['Content-Length'] = str(len(response.content)) return response diff --git a/openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py b/openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py index 9476b63ae2..cceb2ec5b5 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py +++ b/openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py @@ -52,7 +52,7 @@ class CreateGroup(forms.SelfHandlingForm): data['description']) messages.success(request, _('Successfully created security group: %s') - % data['name']) + % data['name']) return sg except Exception: redirect = reverse("horizon:project:access_and_security:index") @@ -82,7 +82,7 @@ class UpdateGroup(forms.SelfHandlingForm): data['description']) messages.success(request, _('Successfully updated security group: %s') - % data['name']) + % data['name']) return sg except Exception: redirect = reverse("horizon:project:access_and_security:index") @@ -206,16 +206,16 @@ class AddRule(forms.SelfHandlingForm): 'data-slug': 'remote'})) cidr = forms.IPField(label=_("CIDR"), - required=False, - initial="0.0.0.0/0", - help_text=_("Classless Inter-Domain Routing " - "(e.g. 192.168.0.0/24)"), - version=forms.IPv4 | forms.IPv6, - mask=True, - widget=forms.TextInput( - attrs={'class': 'switched', - 'data-switch-on': 'remote', - 'data-remote-cidr': _('CIDR')})) + required=False, + initial="0.0.0.0/0", + help_text=_("Classless Inter-Domain Routing " + "(e.g. 192.168.0.0/24)"), + version=forms.IPv4 | forms.IPv6, + mask=True, + widget=forms.TextInput( + attrs={'class': 'switched', + 'data-switch-on': 'remote', + 'data-remote-cidr': _('CIDR')})) security_group = forms.ChoiceField(label=_('Security Group'), required=False, diff --git a/openstack_dashboard/dashboards/project/access_and_security/security_groups/tests.py b/openstack_dashboard/dashboards/project/access_and_security/security_groups/tests.py index 4b9cfda257..30bc72b3ae 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/security_groups/tests.py +++ b/openstack_dashboard/dashboards/project/access_and_security/security_groups/tests.py @@ -81,7 +81,7 @@ class SecurityGroupsViewTests(test.TestCase): def test_update_security_groups_get(self): sec_group = self.security_groups.first() api.network.security_group_get(IsA(http.HttpRequest), - sec_group.id).AndReturn(sec_group) + sec_group.id).AndReturn(sec_group) self.mox.ReplayAll() res = self.client.get(reverse('horizon:project:access_and_security:' @@ -97,12 +97,12 @@ class SecurityGroupsViewTests(test.TestCase): def test_update_security_groups_post(self): sec_group = self.security_groups.get(name="other_group") api.network.security_group_update(IsA(http.HttpRequest), - str(sec_group.id), - sec_group.name, - sec_group.description) \ + str(sec_group.id), + sec_group.name, + sec_group.description) \ .AndReturn(sec_group) api.network.security_group_get(IsA(http.HttpRequest), - sec_group.id).AndReturn(sec_group) + sec_group.id).AndReturn(sec_group) self.mox.ReplayAll() formData = {'method': 'UpdateGroup', @@ -182,8 +182,8 @@ class SecurityGroupsViewTests(test.TestCase): sec_group = self.security_groups.first() api.network.security_group_get(IsA(http.HttpRequest), - sec_group.id) \ - .AndRaise(self.exceptions.nova) + sec_group.id) \ + .AndRaise(self.exceptions.nova) self.mox.ReplayAll() diff --git a/openstack_dashboard/dashboards/project/access_and_security/tests.py b/openstack_dashboard/dashboards/project/access_and_security/tests.py index 40625af178..2e585a71a0 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/tests.py +++ b/openstack_dashboard/dashboards/project/access_and_security/tests.py @@ -206,8 +206,8 @@ class SecurityGroupTabTests(test.TestCase): create_link = tables.CreateGroup() url = create_link.get_link_url() - classes = list(create_link.get_default_classes())\ - + list(create_link.classes) + classes = (list(create_link.get_default_classes()) + + list(create_link.classes)) link_name = "%s (%s)" % (unicode(create_link.verbose_name), "Quota exceeded") expected_string = ".+?)/(?P(.+/)+)' - '?container_detail$', + '?container_detail$', views.ContainerDetailView.as_view(), name='container_detail'), @@ -52,13 +52,13 @@ urlpatterns = patterns(VIEW_MOD, name='object_upload'), url(r'^(?P.+?)/(?P(.+/)+)' - '?create_pseudo_folder', + '?create_pseudo_folder', views.CreatePseudoFolderView.as_view(), name='create_pseudo_folder'), url(r'^(?P[^/]+)/' - r'(?P(.+/)+)?' - r'(?P.+)/copy$', + r'(?P(.+/)+)?' + r'(?P.+)/copy$', views.CopyView.as_view(), name='object_copy'), diff --git a/openstack_dashboard/dashboards/project/data_processing/clusters/workflows/create.py b/openstack_dashboard/dashboards/project/data_processing/clusters/workflows/create.py index 696367fbec..9f76ff607a 100644 --- a/openstack_dashboard/dashboards/project/data_processing/clusters/workflows/create.py +++ b/openstack_dashboard/dashboards/project/data_processing/clusters/workflows/create.py @@ -118,8 +118,8 @@ class GeneralConfigAction(workflows.Action): hadoop_version) return [(image.id, image.name) for image in all_images - if set(details.required_image_tags). - issubset(set(image.tags))] + if (set(details.required_image_tags). + issubset(set(image.tags)))] except Exception: exceptions.handle(request, _("Unable to fetch image choices.")) diff --git a/openstack_dashboard/dashboards/project/database_backups/views.py b/openstack_dashboard/dashboards/project/database_backups/views.py index 98ae5e94e0..e9155e74a0 100644 --- a/openstack_dashboard/dashboards/project/database_backups/views.py +++ b/openstack_dashboard/dashboards/project/database_backups/views.py @@ -93,8 +93,8 @@ class DetailView(horizon_views.APIView): backup.parent = api.trove.backup_get(request, backup.parent_id) except Exception: redirect = reverse('horizon:project:database_backups:index') - msg = _('Unable to retrieve details for parent backup: %s') % \ - backup.parent_id + msg = (_('Unable to retrieve details for parent backup: %s') + % backup.parent_id) exceptions.handle(self.request, msg, redirect=redirect) try: diff --git a/openstack_dashboard/dashboards/project/databases/tests.py b/openstack_dashboard/dashboards/project/databases/tests.py index 2a090dd86d..af8944e0d3 100644 --- a/openstack_dashboard/dashboards/project/databases/tests.py +++ b/openstack_dashboard/dashboards/project/databases/tests.py @@ -121,7 +121,7 @@ class DatabaseTests(test.TestCase): @test.create_stubs({ api.trove: ('flavor_list', 'backup_list', - 'datastore_list', 'datastore_version_list')}) + 'datastore_list', 'datastore_version_list')}) def test_launch_instance(self): api.trove.flavor_list(IsA(http.HttpRequest))\ .AndReturn(self.flavors.list()) @@ -144,7 +144,7 @@ class DatabaseTests(test.TestCase): self.mox.ReplayAll() toSuppress = ["openstack_dashboard.dashboards.project.databases." - "workflows.create_instance", + "workflows.create_instance", "horizon.workflows.base"] # Suppress expected log messages in the test output diff --git a/openstack_dashboard/dashboards/project/firewalls/views.py b/openstack_dashboard/dashboards/project/firewalls/views.py index 07748164aa..f7a7d4997a 100644 --- a/openstack_dashboard/dashboards/project/firewalls/views.py +++ b/openstack_dashboard/dashboards/project/firewalls/views.py @@ -201,7 +201,7 @@ class UpdateFirewallView(forms.ModalFormView): firewall_id = self.kwargs['firewall_id'] try: firewall = api.fwaas.firewall_get(self.request, - firewall_id) + firewall_id) firewall.set_id_as_name_if_empty() return firewall except Exception: diff --git a/openstack_dashboard/dashboards/project/images/images/tests.py b/openstack_dashboard/dashboards/project/images/images/tests.py index afccd41497..e4ee4ec996 100644 --- a/openstack_dashboard/dashboards/project/images/images/tests.py +++ b/openstack_dashboard/dashboards/project/images/images/tests.py @@ -165,7 +165,7 @@ class ImageViewTests(test.TestCase): 'description': data['description'], 'architecture': data['architecture']}, name=data['name']). \ - AndReturn(self.images.first()) + AndReturn(self.images.first()) self.mox.ReplayAll() url = reverse('horizon:project:images:images:create') @@ -205,7 +205,7 @@ class ImageViewTests(test.TestCase): 'architecture': data['architecture']}, name=data['name'], data=IsA(InMemoryUploadedFile)). \ - AndReturn(self.images.first()) + AndReturn(self.images.first()) self.mox.ReplayAll() url = reverse('horizon:project:images:images:create') @@ -219,7 +219,7 @@ class ImageViewTests(test.TestCase): image = self.images.first() api.glance.image_get(IsA(http.HttpRequest), str(image.id)) \ - .AndReturn(self.images.first()) + .AndReturn(self.images.first()) self.mox.ReplayAll() res = self.client.get(reverse('horizon:project:images:images:detail', @@ -237,7 +237,7 @@ class ImageViewTests(test.TestCase): image = self.images.list()[8] api.glance.image_get(IsA(http.HttpRequest), str(image.id)) \ - .AndReturn(image) + .AndReturn(image) self.mox.ReplayAll() res = self.client.get(reverse('horizon:project:images:images:detail', @@ -264,7 +264,7 @@ class ImageViewTests(test.TestCase): image = self.images.list()[2] api.glance.image_get(IsA(http.HttpRequest), str(image.id)) \ - .AndReturn(image) + .AndReturn(image) self.mox.ReplayAll() res = self.client.get( @@ -279,7 +279,7 @@ class ImageViewTests(test.TestCase): image = self.images.first() api.glance.image_get(IsA(http.HttpRequest), str(image.id)) \ - .AndRaise(self.exceptions.glance) + .AndRaise(self.exceptions.glance) self.mox.ReplayAll() url = reverse('horizon:project:images:images:detail', @@ -347,9 +347,10 @@ class OwnerFilterTests(test.TestCase): if filter_string == 'public': return filter(lambda im: im.is_public, images) if filter_string == 'shared': - return filter(lambda im: not im.is_public and - im.owner != my_tenant_id and - im.owner not in special, images) + return filter(lambda im: (not im.is_public and + im.owner != my_tenant_id and + im.owner not in special), + images) if filter_string == 'project': filter_string = my_tenant_id return filter(lambda im: im.owner == filter_string, images) diff --git a/openstack_dashboard/dashboards/project/images/snapshots/tests.py b/openstack_dashboard/dashboards/project/images/snapshots/tests.py index 7482920865..ffe78a61a5 100644 --- a/openstack_dashboard/dashboards/project/images/snapshots/tests.py +++ b/openstack_dashboard/dashboards/project/images/snapshots/tests.py @@ -45,7 +45,7 @@ class SnapshotsViewTests(test.TestCase): server = self.servers.first() self.mox.StubOutWithMock(api.nova, 'server_get') api.nova.server_get(IsA(http.HttpRequest), server.id) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) self.mox.ReplayAll() url = reverse('horizon:project:images:snapshots:create', diff --git a/openstack_dashboard/dashboards/project/images/tests.py b/openstack_dashboard/dashboards/project/images/tests.py index 88344093d5..5479e4f90c 100644 --- a/openstack_dashboard/dashboards/project/images/tests.py +++ b/openstack_dashboard/dashboards/project/images/tests.py @@ -129,11 +129,11 @@ class ImagesAndSnapshotsUtilsTests(test.TestCase): api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([public_images, False, False]) + .AndReturn([public_images, False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([private_images, False, False]) + .AndReturn([private_images, False, False]) self.mox.ReplayAll() @@ -154,15 +154,15 @@ class ImagesAndSnapshotsUtilsTests(test.TestCase): api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([public_images, False, False]) + .AndReturn([public_images, False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([private_images, False, False]) + .AndReturn([private_images, False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': 'other-tenant', 'status': 'active'}) \ - .AndReturn([private_images, False, False]) + .AndReturn([private_images, False, False]) self.mox.ReplayAll() @@ -209,17 +209,17 @@ class ImagesAndSnapshotsUtilsTests(test.TestCase): api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndRaise(self.exceptions.glance) + .AndRaise(self.exceptions.glance) exceptions.handle(IsA(http.HttpRequest), "Unable to retrieve public images.") api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([private_images, False, False]) + .AndReturn([private_images, False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([public_images, False, False]) + .AndReturn([public_images, False, False]) self.mox.ReplayAll() @@ -261,17 +261,17 @@ class ImagesAndSnapshotsUtilsTests(test.TestCase): api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([public_images, False, False]) + .AndReturn([public_images, False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndRaise(self.exceptions.glance) + .AndRaise(self.exceptions.glance) exceptions.handle(IsA(http.HttpRequest), "Unable to retrieve images for the current project.") api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([private_images, False, False]) + .AndReturn([private_images, False, False]) self.mox.ReplayAll() diff --git a/openstack_dashboard/dashboards/project/instances/forms.py b/openstack_dashboard/dashboards/project/instances/forms.py index 117d7a62b3..3398b1436a 100644 --- a/openstack_dashboard/dashboards/project/instances/forms.py +++ b/openstack_dashboard/dashboards/project/instances/forms.py @@ -37,8 +37,8 @@ class RebuildInstanceForm(forms.SelfHandlingForm): image = forms.ChoiceField(label=_("Select Image"), widget=forms.SelectWidget(attrs={'class': 'image-selector'}, - data_attrs=('size', 'display-name'), - transform=_image_choice_title)) + data_attrs=('size', 'display-name'), + transform=_image_choice_title)) password = forms.RegexField(label=_("Rebuild Password"), required=False, widget=forms.PasswordInput(render_value=False), diff --git a/openstack_dashboard/dashboards/project/instances/tests.py b/openstack_dashboard/dashboards/project/instances/tests.py index 163af69f07..bbce02341f 100644 --- a/openstack_dashboard/dashboards/project/instances/tests.py +++ b/openstack_dashboard/dashboards/project/instances/tests.py @@ -314,7 +314,7 @@ class InstanceTests(helpers.TestCase): api.glance.image_list_detailed(IgnoreArg()) \ .AndReturn((self.images.list(), False, False)) api.nova.server_delete(IsA(http.HttpRequest), server.id) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) self.mox.ReplayAll() @@ -375,7 +375,7 @@ class InstanceTests(helpers.TestCase): .AndReturn([servers, False]) api.network.servers_update_addresses(IsA(http.HttpRequest), servers) api.nova.server_pause(IsA(http.HttpRequest), server.id) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) self.mox.ReplayAll() @@ -437,7 +437,7 @@ class InstanceTests(helpers.TestCase): .AndReturn([servers, False]) api.network.servers_update_addresses(IsA(http.HttpRequest), servers) api.nova.server_unpause(IsA(http.HttpRequest), server.id) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) self.mox.ReplayAll() @@ -689,9 +689,9 @@ class InstanceTests(helpers.TestCase): api.nova.instance_volumes_list(IsA(http.HttpRequest), server.id).AndReturn(volumes_return) api.nova.flavor_get(IsA(http.HttpRequest), server.flavor['id']) \ - .AndReturn(flavor_return) + .AndReturn(flavor_return) api.network.server_security_groups(IsA(http.HttpRequest), server.id) \ - .AndReturn(security_groups_return) + .AndReturn(security_groups_return) api.network.floating_ip_simple_associate_supported( IsA(http.HttpRequest)).MultipleTimes().AndReturn(True) api.network.floating_ip_supported(IsA(http.HttpRequest)) \ @@ -796,7 +796,7 @@ class InstanceTests(helpers.TestCase): server = self.servers.first() api.nova.server_get(IsA(http.HttpRequest), server.id) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) self.mox.ReplayAll() @@ -827,7 +827,7 @@ class InstanceTests(helpers.TestCase): api.nova.server_console_output(IsA(http.HttpRequest), server.id, tail_length=None) \ - .AndReturn(CONSOLE_OUTPUT) + .AndReturn(CONSOLE_OUTPUT) self.mox.ReplayAll() @@ -847,7 +847,7 @@ class InstanceTests(helpers.TestCase): api.nova.server_console_output(IsA(http.HttpRequest), server.id, tail_length=None) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) self.mox.ReplayAll() @@ -1034,7 +1034,7 @@ class InstanceTests(helpers.TestCase): servers = self.servers.list() api.nova.extension_supported('AdminActions', IsA(http.HttpRequest)) \ - .MultipleTimes().AndReturn(True) + .MultipleTimes().AndReturn(True) api.nova.flavor_list(IsA(http.HttpRequest)) \ .AndReturn(self.flavors.list()) api.glance.image_list_detailed(IgnoreArg()) \ @@ -1117,7 +1117,7 @@ class InstanceTests(helpers.TestCase): server = self.servers.first() api.nova.server_get(IsA(http.HttpRequest), server.id) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) self.mox.ReplayAll() @@ -1181,7 +1181,7 @@ class InstanceTests(helpers.TestCase): server.id).AndReturn([]) api.nova.server_update(IsA(http.HttpRequest), server.id, server.name) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) api.network.server_update_security_groups( IsA(http.HttpRequest), server.id, []) @@ -1235,11 +1235,11 @@ class InstanceTests(helpers.TestCase): api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ - .AndReturn(block_device_mapping_v2) + .AndReturn(block_device_mapping_v2) cinder.volume_list(IsA(http.HttpRequest)) \ - .AndReturn(self.volumes.list()) + .AndReturn(self.volumes.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)) \ - .AndReturn(self.volumes.list()) + .AndReturn(self.volumes.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ @@ -1247,11 +1247,11 @@ class InstanceTests(helpers.TestCase): api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.neutron.network_list(IsA(http.HttpRequest), tenant_id=self.tenant.id, shared=False) \ - .AndReturn(self.networks.list()[:1]) + .AndReturn(self.networks.list()[:1]) if only_one_network: api.neutron.network_list(IsA(http.HttpRequest), shared=True).AndReturn([]) @@ -1265,21 +1265,21 @@ class InstanceTests(helpers.TestCase): 'policy').AndReturn(policy_profiles) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(disk_config) + .AndReturn(disk_config) api.nova.extension_supported('ConfigDrive', IsA(http.HttpRequest)).AndReturn(config_drive) api.nova.tenant_absolute_limits(IsA(http.HttpRequest))\ - .AndReturn(self.limits['absolute']) + .AndReturn(self.limits['absolute']) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn(self.keypairs.list()) + .AndReturn(self.keypairs.list()) api.network.security_group_list(IsA(http.HttpRequest)) \ - .AndReturn(self.security_groups.list()) + .AndReturn(self.security_groups.list()) api.nova.availability_zone_list(IsA(http.HttpRequest)) \ - .AndReturn(self.availability_zones.list()) + .AndReturn(self.availability_zones.list()) self.mox.ReplayAll() @@ -1442,11 +1442,11 @@ class InstanceTests(helpers.TestCase): test_with_profile=False): api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ - .AndReturn(block_device_mapping_v2) + .AndReturn(block_device_mapping_v2) cinder.volume_list(IsA(http.HttpRequest)) \ - .AndReturn(self.volumes.list()) + .AndReturn(self.volumes.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)) \ - .AndReturn(self.volumes.list()) + .AndReturn(self.volumes.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ @@ -1454,11 +1454,11 @@ class InstanceTests(helpers.TestCase): api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.neutron.network_list(IsA(http.HttpRequest), tenant_id=self.tenant.id, shared=False) \ - .AndReturn(self.networks.list()[:1]) + .AndReturn(self.networks.list()[:1]) if only_one_network: api.neutron.network_list(IsA(http.HttpRequest), shared=True).AndReturn([]) @@ -1473,21 +1473,21 @@ class InstanceTests(helpers.TestCase): 'policy').AndReturn(policy_profiles) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(disk_config) - api.nova.extension_supported('ConfigDrive', - IsA(http.HttpRequest)).AndReturn(config_drive) + .AndReturn(disk_config) + api.nova.extension_supported( + 'ConfigDrive', IsA(http.HttpRequest)).AndReturn(config_drive) api.nova.tenant_absolute_limits(IsA(http.HttpRequest))\ - .AndReturn(self.limits['absolute']) + .AndReturn(self.limits['absolute']) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn(self.keypairs.list()) + .AndReturn(self.keypairs.list()) api.network.security_group_list(IsA(http.HttpRequest)) \ - .AndReturn(self.security_groups.list()) + .AndReturn(self.security_groups.list()) api.nova.availability_zone_list(IsA(http.HttpRequest)) \ - .AndReturn(self.availability_zones.list()) + .AndReturn(self.availability_zones.list()) self.mox.ReplayAll() @@ -1497,8 +1497,8 @@ class InstanceTests(helpers.TestCase): bootable_volumes = [v.id for v in self.volumes.list() if v.bootable == 'true' and v.status == 'available'] - volume_sources = res.context_data['workflow'].steps[0].\ - action.fields['volume_id'].choices + volume_sources = (res.context_data['workflow'].steps[0]. + action.fields['volume_id'].choices) volume_sources_ids = [] for volume in volume_sources: @@ -1516,18 +1516,18 @@ class InstanceTests(helpers.TestCase): self.test_launch_instance_get_bootable_volumes(test_with_profile=True) @helpers.create_stubs({api.glance: ('image_list_detailed',), - api.neutron: ('network_list', - 'profile_list', - 'port_create',), - api.nova: ('extension_supported', - 'flavor_list', - 'keypair_list', - 'availability_zone_list', - 'server_create',), - api.network: ('security_group_list',), - cinder: ('volume_list', - 'volume_snapshot_list',), - quotas: ('tenant_quota_usages',)}) + api.neutron: ('network_list', + 'profile_list', + 'port_create',), + api.nova: ('extension_supported', + 'flavor_list', + 'keypair_list', + 'availability_zone_list', + 'server_create',), + api.network: ('security_group_list',), + cinder: ('volume_list', + 'volume_snapshot_list',), + quotas: ('tenant_quota_usages',)}) def test_launch_instance_post(self, disk_config=True, config_drive=True, @@ -1544,30 +1544,30 @@ class InstanceTests(helpers.TestCase): api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn(self.keypairs.list()) + .AndReturn(self.keypairs.list()) api.network.security_group_list(IsA(http.HttpRequest)) \ - .AndReturn(self.security_groups.list()) + .AndReturn(self.security_groups.list()) api.nova.availability_zone_list(IsA(http.HttpRequest)) \ - .AndReturn(self.availability_zones.list()) + .AndReturn(self.availability_zones.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.neutron.network_list(IsA(http.HttpRequest), tenant_id=self.tenant.id, shared=False) \ - .AndReturn(self.networks.list()[:1]) + .AndReturn(self.networks.list()[:1]) api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ - .AndReturn(self.networks.list()[1:]) + .AndReturn(self.networks.list()[1:]) if test_with_profile: policy_profiles = self.policy_profiles.list() policy_profile_id = self.policy_profiles.first().id @@ -1582,11 +1582,11 @@ class InstanceTests(helpers.TestCase): nics = [{"port-id": port.id}] api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(disk_config) - api.nova.extension_supported('ConfigDrive', - IsA(http.HttpRequest)).AndReturn(config_drive) + .AndReturn(disk_config) + api.nova.extension_supported( + 'ConfigDrive', IsA(http.HttpRequest)).AndReturn(config_drive) cinder.volume_list(IsA(http.HttpRequest)) \ - .AndReturn([]) + .AndReturn([]) cinder.volume_snapshot_list(IsA(http.HttpRequest)).AndReturn([]) if disk_config: disk_config_value = u'AUTO' @@ -1612,7 +1612,7 @@ class InstanceTests(helpers.TestCase): disk_config=disk_config_value, config_drive=config_drive_value) quotas.tenant_quota_usages(IsA(http.HttpRequest)) \ - .AndReturn(quota_usages) + .AndReturn(quota_usages) api.nova.flavor_list(IsA(http.HttpRequest)) \ .AndReturn(self.flavors.list()) @@ -1685,32 +1685,32 @@ class InstanceTests(helpers.TestCase): api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn(self.keypairs.list()) + .AndReturn(self.keypairs.list()) api.network.security_group_list(IsA(http.HttpRequest)) \ - .AndReturn(self.security_groups.list()) + .AndReturn(self.security_groups.list()) api.nova.availability_zone_list(IsA(http.HttpRequest)) \ - .AndReturn(self.availability_zones.list()) + .AndReturn(self.availability_zones.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.neutron.network_list(IsA(http.HttpRequest), tenant_id=self.tenant.id, shared=False) \ - .AndReturn(self.networks.list()[:1]) + .AndReturn(self.networks.list()[:1]) api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ - .AndReturn(self.networks.list()[1:]) + .AndReturn(self.networks.list()[1:]) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) if test_with_profile: policy_profiles = self.policy_profiles.list() policy_profile_id = self.policy_profiles.first().id @@ -1725,11 +1725,11 @@ class InstanceTests(helpers.TestCase): nics = [{"port-id": port.id}] api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.extension_supported('ConfigDrive', IsA(http.HttpRequest)).AndReturn(True) cinder.volume_list(IsA(http.HttpRequest)) \ - .AndReturn(self.volumes.list()) + .AndReturn(self.volumes.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)).AndReturn([]) api.nova.server_create(IsA(http.HttpRequest), server.name, @@ -1747,7 +1747,7 @@ class InstanceTests(helpers.TestCase): disk_config=u'AUTO', config_drive=True) quotas.tenant_quota_usages(IsA(http.HttpRequest)) \ - .AndReturn(quota_usages) + .AndReturn(quota_usages) self.mox.ReplayAll() @@ -1815,33 +1815,33 @@ class InstanceTests(helpers.TestCase): api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn(self.keypairs.list()) + .AndReturn(self.keypairs.list()) api.network.security_group_list(IsA(http.HttpRequest)) \ - .AndReturn(self.security_groups.list()) + .AndReturn(self.security_groups.list()) api.nova.availability_zone_list(IsA(http.HttpRequest)) \ .AndReturn(self.availability_zones.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.neutron.network_list(IsA(http.HttpRequest), tenant_id=self.tenant.id, shared=False) \ - .AndReturn(self.networks.list()[:1]) + .AndReturn(self.networks.list()[:1]) api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ - .AndReturn(self.networks.list()[1:]) + .AndReturn(self.networks.list()[1:]) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) if test_with_profile: policy_profiles = self.policy_profiles.list() policy_profile_id = self.policy_profiles.first().id @@ -1856,14 +1856,14 @@ class InstanceTests(helpers.TestCase): nics = [{"port-id": port.id}] api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.extension_supported('ConfigDrive', IsA(http.HttpRequest)).AndReturn(True) cinder.volume_list(IsA(http.HttpRequest)) \ - .AndReturn(self.volumes.list()) + .AndReturn(self.volumes.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)).AndReturn([]) quotas.tenant_quota_usages(IsA(http.HttpRequest)) \ - .AndReturn(quota_usages) + .AndReturn(quota_usages) api.nova.server_create(IsA(http.HttpRequest), server.name, @@ -1939,50 +1939,50 @@ class InstanceTests(helpers.TestCase): api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \ .AndReturn(self.limits['absolute']) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.neutron.network_list(IsA(http.HttpRequest), tenant_id=self.tenant.id, shared=False) \ - .AndReturn(self.networks.list()[:1]) + .AndReturn(self.networks.list()[:1]) api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ - .AndReturn(self.networks.list()[1:]) + .AndReturn(self.networks.list()[1:]) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'policy').AndReturn(policy_profiles) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.extension_supported('ConfigDrive', IsA(http.HttpRequest)).AndReturn(True) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn(self.keypairs.list()) + .AndReturn(self.keypairs.list()) api.network.security_group_list(IsA(http.HttpRequest)) \ - .AndReturn(self.security_groups.list()) + .AndReturn(self.security_groups.list()) api.nova.availability_zone_list(IsA(http.HttpRequest)) \ - .AndReturn(self.availability_zones.list()) + .AndReturn(self.availability_zones.list()) cinder.volume_list(IsA(http.HttpRequest)) \ - .AndReturn([]) + .AndReturn([]) cinder.volume_snapshot_list(IsA(http.HttpRequest)).AndReturn([]) quotas.tenant_quota_usages(IsA(http.HttpRequest)) \ - .AndReturn(quota_usages) + .AndReturn(quota_usages) self.mox.ReplayAll() @@ -2026,7 +2026,7 @@ class InstanceTests(helpers.TestCase): test_with_profile=False): api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) cinder.volume_list(IsA(http.HttpRequest)) \ .AndReturn(self.volumes.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)) \ @@ -2034,39 +2034,39 @@ class InstanceTests(helpers.TestCase): api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.neutron.network_list(IsA(http.HttpRequest), tenant_id=self.tenant.id, shared=False) \ - .AndReturn(self.networks.list()[:1]) + .AndReturn(self.networks.list()[:1]) api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ - .AndReturn(self.networks.list()[1:]) + .AndReturn(self.networks.list()[1:]) if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'policy').AndReturn(policy_profiles) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.extension_supported('ConfigDrive', IsA(http.HttpRequest)).AndReturn(True) api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \ - .AndReturn(self.limits['absolute']) + .AndReturn(self.limits['absolute']) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn(self.keypairs.list()) + .AndReturn(self.keypairs.list()) api.network.security_group_list(IsA(http.HttpRequest)) \ - .AndReturn(self.security_groups.list()) + .AndReturn(self.security_groups.list()) api.nova.availability_zone_list(IsA(http.HttpRequest)) \ - .AndReturn(self.availability_zones.list()) + .AndReturn(self.availability_zones.list()) self.mox.ReplayAll() @@ -2107,30 +2107,30 @@ class InstanceTests(helpers.TestCase): api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) cinder.volume_snapshot_list(IsA(http.HttpRequest)) \ - .AndReturn(self.volumes.list()) + .AndReturn(self.volumes.list()) api.nova.flavor_list(IgnoreArg()).AndReturn(self.flavors.list()) api.nova.keypair_list(IgnoreArg()).AndReturn(self.keypairs.list()) api.network.security_group_list(IsA(http.HttpRequest)) \ - .AndReturn(self.security_groups.list()) + .AndReturn(self.security_groups.list()) api.nova.availability_zone_list(IsA(http.HttpRequest)) \ - .AndReturn(self.availability_zones.list()) + .AndReturn(self.availability_zones.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.neutron.network_list(IsA(http.HttpRequest), tenant_id=self.tenant.id, shared=False) \ - .AndReturn(self.networks.list()[:1]) + .AndReturn(self.networks.list()[:1]) api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ - .AndReturn(self.networks.list()[1:]) + .AndReturn(self.networks.list()[1:]) if test_with_profile: policy_profiles = self.policy_profiles.list() policy_profile_id = self.policy_profiles.first().id @@ -2145,7 +2145,7 @@ class InstanceTests(helpers.TestCase): nics = [{"port-id": port.id}] api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.extension_supported('ConfigDrive', IsA(http.HttpRequest)).AndReturn(True) cinder.volume_list(IgnoreArg()).AndReturn(self.volumes.list()) @@ -2164,9 +2164,9 @@ class InstanceTests(helpers.TestCase): admin_pass='password', disk_config='AUTO', config_drive=False) \ - .AndRaise(self.exceptions.keystone) + .AndRaise(self.exceptions.keystone) quotas.tenant_quota_usages(IsA(http.HttpRequest)) \ - .AndReturn(quota_usages) + .AndReturn(quota_usages) api.nova.flavor_list(IsA(http.HttpRequest)) \ .AndReturn(self.flavors.list()) @@ -2232,51 +2232,51 @@ class InstanceTests(helpers.TestCase): api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn(self.keypairs.list()) + .AndReturn(self.keypairs.list()) api.network.security_group_list(IsA(http.HttpRequest)) \ - .AndReturn(self.security_groups.list()) + .AndReturn(self.security_groups.list()) api.nova.availability_zone_list(IsA(http.HttpRequest)) \ - .AndReturn(self.availability_zones.list()) + .AndReturn(self.availability_zones.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.neutron.network_list(IsA(http.HttpRequest), tenant_id=self.tenant.id, shared=False) \ - .AndReturn(self.networks.list()[:1]) + .AndReturn(self.networks.list()[:1]) api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ - .AndReturn(self.networks.list()[1:]) + .AndReturn(self.networks.list()[1:]) if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'policy').AndReturn(policy_profiles) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.extension_supported('ConfigDrive', IsA(http.HttpRequest)).AndReturn(True) cinder.volume_list(IsA(http.HttpRequest)) \ - .AndReturn(self.volumes.list()) + .AndReturn(self.volumes.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)).AndReturn([]) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \ .AndReturn(self.limits['absolute']) quotas.tenant_quota_usages(IsA(http.HttpRequest)) \ - .AndReturn(quota_usages) + .AndReturn(quota_usages) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) self.mox.ReplayAll() @@ -2333,51 +2333,51 @@ class InstanceTests(helpers.TestCase): api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn(self.keypairs.list()) + .AndReturn(self.keypairs.list()) api.network.security_group_list(IsA(http.HttpRequest)) \ - .AndReturn(self.security_groups.list()) + .AndReturn(self.security_groups.list()) api.nova.availability_zone_list(IsA(http.HttpRequest)) \ - .AndReturn(self.availability_zones.list()) + .AndReturn(self.availability_zones.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.neutron.network_list(IsA(http.HttpRequest), tenant_id=self.tenant.id, shared=False) \ - .AndReturn(self.networks.list()[:1]) + .AndReturn(self.networks.list()[:1]) api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ - .AndReturn(self.networks.list()[1:]) + .AndReturn(self.networks.list()[1:]) if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'policy').AndReturn(policy_profiles) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.extension_supported('ConfigDrive', IsA(http.HttpRequest)).AndReturn(True) cinder.volume_list(IsA(http.HttpRequest)) \ - .AndReturn(self.volumes.list()) + .AndReturn(self.volumes.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)).AndReturn([]) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \ .AndReturn(self.limits['absolute']) quotas.tenant_quota_usages(IsA(http.HttpRequest)) \ - .AndReturn(quota_usages) + .AndReturn(quota_usages) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) self.mox.ReplayAll() @@ -2451,51 +2451,51 @@ class InstanceTests(helpers.TestCase): api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn(self.keypairs.list()) + .AndReturn(self.keypairs.list()) api.network.security_group_list(IsA(http.HttpRequest)) \ - .AndReturn(self.security_groups.list()) + .AndReturn(self.security_groups.list()) api.nova.availability_zone_list(IsA(http.HttpRequest)) \ - .AndReturn(self.availability_zones.list()) + .AndReturn(self.availability_zones.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.neutron.network_list(IsA(http.HttpRequest), tenant_id=self.tenant.id, shared=False) \ - .AndReturn(self.networks.list()[:1]) + .AndReturn(self.networks.list()[:1]) api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ - .AndReturn(self.networks.list()[1:]) + .AndReturn(self.networks.list()[1:]) if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'policy').AndReturn(policy_profiles) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.extension_supported('ConfigDrive', IsA(http.HttpRequest)).AndReturn(True) cinder.volume_list(IsA(http.HttpRequest)) \ - .AndReturn(self.volumes.list()) + .AndReturn(self.volumes.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)).AndReturn([]) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \ .AndReturn(self.limits['absolute']) quotas.tenant_quota_usages(IsA(http.HttpRequest)) \ - .AndReturn(quota_usages) + .AndReturn(quota_usages) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) self.mox.ReplayAll() @@ -2580,51 +2580,51 @@ class InstanceTests(helpers.TestCase): api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn(self.keypairs.list()) + .AndReturn(self.keypairs.list()) api.network.security_group_list(IsA(http.HttpRequest)) \ - .AndReturn(self.security_groups.list()) + .AndReturn(self.security_groups.list()) api.nova.availability_zone_list(IsA(http.HttpRequest)) \ - .AndReturn(self.availability_zones.list()) + .AndReturn(self.availability_zones.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.neutron.network_list(IsA(http.HttpRequest), tenant_id=self.tenant.id, shared=False) \ - .AndReturn(self.networks.list()[:1]) + .AndReturn(self.networks.list()[:1]) api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ - .AndReturn(self.networks.list()[1:]) + .AndReturn(self.networks.list()[1:]) if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'policy').AndReturn(policy_profiles) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.extension_supported('ConfigDrive', IsA(http.HttpRequest)).AndReturn(True) cinder.volume_list(IsA(http.HttpRequest)) \ - .AndReturn(self.volumes.list()) + .AndReturn(self.volumes.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)).AndReturn([]) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \ - .AndReturn(self.limits['absolute']) + .AndReturn(self.limits['absolute']) quotas.tenant_quota_usages(IsA(http.HttpRequest)) \ - .AndReturn(quota_usages) + .AndReturn(quota_usages) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) self.mox.ReplayAll() @@ -2780,9 +2780,9 @@ class InstanceTests(helpers.TestCase): keypair = self.keypairs.first() cinder.volume_list(IsA(http.HttpRequest)) \ - .AndReturn(self.volumes.list()) + .AndReturn(self.volumes.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)) \ - .AndReturn(self.volumes.list()) + .AndReturn(self.volumes.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ @@ -2790,14 +2790,14 @@ class InstanceTests(helpers.TestCase): api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) api.neutron.network_list(IsA(http.HttpRequest), tenant_id=self.tenant.id, shared=False) \ - .AndReturn(self.networks.list()[:1]) + .AndReturn(self.networks.list()[:1]) api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ - .AndReturn(self.networks.list()[1:]) + .AndReturn(self.networks.list()[1:]) if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), @@ -2806,22 +2806,22 @@ class InstanceTests(helpers.TestCase): .AndReturn(self.limits['absolute']) api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.extension_supported('ConfigDrive', IsA(http.HttpRequest)).AndReturn(True) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.keypair_list(IsA(http.HttpRequest)) \ - .AndReturn([keypair]) + .AndReturn([keypair]) api.network.security_group_list(IsA(http.HttpRequest)) \ - .AndReturn(self.security_groups.list()) + .AndReturn(self.security_groups.list()) api.nova.availability_zone_list(IsA(http.HttpRequest)) \ - .AndReturn(self.availability_zones.list()) + .AndReturn(self.availability_zones.list()) self.mox.ReplayAll() @@ -2914,16 +2914,16 @@ class InstanceTests(helpers.TestCase): def test_instance_resize_get(self): server = self.servers.first() api.nova.server_get(IsA(http.HttpRequest), server.id) \ - .AndReturn(server) + .AndReturn(server) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \ .AndReturn(self.limits['absolute']) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) self.mox.ReplayAll() @@ -2941,7 +2941,7 @@ class InstanceTests(helpers.TestCase): server = self.servers.first() api.nova.server_get(IsA(http.HttpRequest), server.id) \ - .AndRaise(self.exceptions.nova) + .AndRaise(self.exceptions.nova) self.mox.ReplayAll() @@ -2957,7 +2957,7 @@ class InstanceTests(helpers.TestCase): server = self.servers.first() api.nova.server_get(IsA(http.HttpRequest), server.id) \ - .AndReturn(server) + .AndReturn(server) api.nova.flavor_list(IsA(http.HttpRequest)) \ .AndRaise(self.exceptions.nova) @@ -2988,12 +2988,12 @@ class InstanceTests(helpers.TestCase): flavor = self.flavors.first() api.nova.server_get(IsA(http.HttpRequest), server.id) \ - .AndReturn(server) + .AndReturn(server) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.server_resize(IsA(http.HttpRequest), server.id, flavor.id, 'AUTO').AndReturn([]) @@ -3009,12 +3009,12 @@ class InstanceTests(helpers.TestCase): flavor = self.flavors.first() api.nova.server_get(IsA(http.HttpRequest), server.id) \ - .AndReturn(server) + .AndReturn(server) api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) + .AndReturn(self.flavors.list()) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.server_resize(IsA(http.HttpRequest), server.id, flavor.id, 'AUTO') \ .AndRaise(self.exceptions.nova) @@ -3157,7 +3157,7 @@ class InstanceTests(helpers.TestCase): .AndReturn([[], False, False]) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) self.mox.ReplayAll() res = self._instance_rebuild_post(server.id, image.id, @@ -3182,7 +3182,7 @@ class InstanceTests(helpers.TestCase): .AndReturn([[], False, False]) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.server_rebuild(IsA(http.HttpRequest), server.id, image.id, @@ -3214,7 +3214,7 @@ class InstanceTests(helpers.TestCase): .AndReturn([[], False, False]) api.nova.extension_supported('DiskConfig', IsA(http.HttpRequest)) \ - .AndReturn(True) + .AndReturn(True) api.nova.server_rebuild(IsA(http.HttpRequest), server.id, image.id, @@ -3503,8 +3503,7 @@ class ConsoleManagerTests(helpers.TestCase): self.setup_consoles() url = '/SPICE&title=%s(%s)' % (server.name, server.id) - data = console.get_console(self.request, 'SPICE', - server) + data = console.get_console(self.request, 'SPICE', server) self.assertEqual(data, url) def test_get_console_rdp(self): diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py index 07c8cc6a31..7400e33da6 100644 --- a/openstack_dashboard/dashboards/project/instances/views.py +++ b/openstack_dashboard/dashboards/project/instances/views.py @@ -278,7 +278,7 @@ class DetailView(tabs.TabView): exceptions.handle(self.request, _('Unable to retrieve details for ' 'instance "%s".') % instance_id, - redirect=redirect) + redirect=redirect) # Not all exception types handled above will result in a redirect. # Need to raise here just in case. raise exceptions.Http302(redirect) diff --git a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py index 5d0ada1e17..fbe88b4232 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py @@ -98,7 +98,7 @@ class SetInstanceDetailsAction(workflows.Action): volume_id = forms.ChoiceField(label=_("Volume"), required=False) volume_snapshot_id = forms.ChoiceField(label=_("Volume Snapshot"), - required=False) + required=False) image_id = forms.ChoiceField( label=_("Image Name"), @@ -323,7 +323,7 @@ class SetInstanceDetailsAction(workflows.Action): _('Unable to retrieve availability zones.')) zone_list = [(zone.zoneName, zone.zoneName) - for zone in zones if zone.zoneState['available']] + for zone in zones if zone.zoneState['available']] zone_list.sort() if not zone_list: zone_list.insert(0, ("", _("No availability zones found"))) @@ -346,7 +346,7 @@ class SetInstanceDetailsAction(workflows.Action): attrs = [{'id': i.id, 'min_disk': getattr(i, 'min_disk', 0), 'min_ram': getattr(i, 'min_ram', 0)} - for i in images] + for i in images] extra['images'] = json.dumps(attrs) except Exception: @@ -409,8 +409,8 @@ class SetInstanceDetailsAction(workflows.Action): try: volumes = [self._get_volume_display_name(v) for v in cinder.volume_list(self.request) - if v.status == api.cinder.VOLUME_STATE_AVAILABLE - and v.bootable == 'true'] + if (v.status == api.cinder.VOLUME_STATE_AVAILABLE + and v.bootable == 'true')] except Exception: volumes = [] exceptions.handle(self.request, @@ -570,8 +570,8 @@ class CustomizeAction(workflows.Action): attributes = {'class': 'switchable', 'data-slug': 'scriptsource'} script_source = forms.ChoiceField(label=_('Customization Script Source'), - choices=source_choices, - widget=forms.Select(attrs=attributes)) + choices=source_choices, + widget=forms.Select(attrs=attributes)) script_help = _("A script or set of commands to be executed after the " "instance has been built (max 16kb).") diff --git a/openstack_dashboard/dashboards/project/loadbalancers/forms.py b/openstack_dashboard/dashboards/project/loadbalancers/forms.py index 3c286e4b5d..9939a19d06 100644 --- a/openstack_dashboard/dashboards/project/loadbalancers/forms.py +++ b/openstack_dashboard/dashboards/project/loadbalancers/forms.py @@ -32,8 +32,8 @@ LOG = logging.getLogger(__name__) class UpdatePool(forms.SelfHandlingForm): name = forms.CharField(max_length=80, label=_("Name")) pool_id = forms.CharField(label=_("ID"), - widget=forms.TextInput( - attrs={'readonly': 'readonly'})) + widget=forms.TextInput( + attrs={'readonly': 'readonly'})) description = forms.CharField(required=False, max_length=80, label=_("Description")) lb_method = forms.ChoiceField(label=_("Load Balancing Method")) @@ -74,8 +74,8 @@ class UpdatePool(forms.SelfHandlingForm): class UpdateVip(forms.SelfHandlingForm): name = forms.CharField(max_length=80, label=_("Name")) vip_id = forms.CharField(label=_("ID"), - widget=forms.TextInput( - attrs={'readonly': 'readonly'})) + widget=forms.TextInput( + attrs={'readonly': 'readonly'})) description = forms.CharField(required=False, max_length=80, label=_("Description")) pool_id = forms.ChoiceField(label=_("Pool")) @@ -169,8 +169,8 @@ class UpdateVip(forms.SelfHandlingForm): class UpdateMember(forms.SelfHandlingForm): member_id = forms.CharField(label=_("ID"), - widget=forms.TextInput( - attrs={'readonly': 'readonly'})) + widget=forms.TextInput( + attrs={'readonly': 'readonly'})) pool_id = forms.ChoiceField(label=_("Pool")) weight = forms.IntegerField(max_value=256, min_value=0, label=_("Weight"), help_text=_("Relative part of requests this " diff --git a/openstack_dashboard/dashboards/project/loadbalancers/views.py b/openstack_dashboard/dashboards/project/loadbalancers/views.py index de55889dde..6d54e73360 100644 --- a/openstack_dashboard/dashboards/project/loadbalancers/views.py +++ b/openstack_dashboard/dashboards/project/loadbalancers/views.py @@ -77,7 +77,7 @@ class IndexView(tabs.TabView): except Exception as e: exceptions.handle(request, _('Unable to locate VIP to delete. %s') - % e) + % e) if vip_id is not None: try: api.lbaas.vip_delete(request, vip_id) diff --git a/openstack_dashboard/dashboards/project/networks/subnets/workflows.py b/openstack_dashboard/dashboards/project/networks/subnets/workflows.py index 4c381fbd16..fbbb12e5f7 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/workflows.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/workflows.py @@ -79,14 +79,14 @@ class CreateSubnet(network_workflows.CreateNetwork): class UpdateSubnetInfoAction(CreateSubnetInfoAction): cidr = forms.IPField(label=_("Network Address"), - required=False, - initial="", - widget=forms.TextInput( - attrs={'readonly': 'readonly'}), - help_text=_("Network address in CIDR format " - "(e.g. 192.168.0.0/24)"), - version=forms.IPv4 | forms.IPv6, - mask=True) + required=False, + initial="", + widget=forms.TextInput( + attrs={'readonly': 'readonly'}), + help_text=_("Network address in CIDR format " + "(e.g. 192.168.0.0/24)"), + version=forms.IPv4 | forms.IPv6, + mask=True) # NOTE(amotoki): When 'disabled' attribute is set for the ChoiceField # and ValidationError is raised for POST request, the initial value of # the ip_version ChoiceField is not set in the re-displayed form diff --git a/openstack_dashboard/dashboards/project/networks/tests.py b/openstack_dashboard/dashboards/project/networks/tests.py index 3034598415..0e3390c251 100644 --- a/openstack_dashboard/dashboards/project/networks/tests.py +++ b/openstack_dashboard/dashboards/project/networks/tests.py @@ -1790,8 +1790,8 @@ class NetworkViewTests(test.TestCase): create_link = tables.CreateNetwork() url = create_link.get_link_url() - classes = list(create_link.get_default_classes())\ - + list(create_link.classes) + classes = (list(create_link.get_default_classes()) + + list(create_link.classes)) link_name = "%s (%s)" % (unicode(create_link.verbose_name), "Quota exceeded") expected_string = "= int(rd.broadcast) or - int(dst.broadcast) <= int(rd.network) or - int(src.network) >= int(rs.broadcast) or - int(src.broadcast) <= int(rs.network)): + int(dst.broadcast) <= int(rd.network) or + int(src.network) >= int(rs.broadcast) or + int(src.broadcast) <= int(rs.network)): continue # skip matching rules for 'any' and 'external' networks @@ -194,7 +194,7 @@ class RulesGridTab(tabs.Tab): reverse=True) match = sortedrules[0] if (match['bitsinsrc'] > src.prefixlen or - match['bitsindst'] > dst.prefixlen): + match['bitsindst'] > dst.prefixlen): connectivity['reachable'] = 'partial' connectivity['conflicting_rule'] = match['rule'] return connectivity diff --git a/openstack_dashboard/dashboards/project/routers/tests.py b/openstack_dashboard/dashboards/project/routers/tests.py index 7c1869b21d..4111ea8131 100644 --- a/openstack_dashboard/dashboards/project/routers/tests.py +++ b/openstack_dashboard/dashboards/project/routers/tests.py @@ -777,8 +777,8 @@ class RouterViewTests(test.TestCase): create_link = tables.CreateRouter() url = create_link.get_link_url() - classes = list(create_link.get_default_classes())\ - + list(create_link.classes) + classes = (list(create_link.get_default_classes()) + + list(create_link.classes)) link_name = "%s (%s)" % (unicode(create_link.verbose_name), "Quota exceeded") expected_string = "', html=True) - self.assertContains(res, '', html=True) + self.assertContains(res, + '', html=True) + self.assertContains(res, + '', html=True) @test.create_stubs({api.heat: ('template_validate',)}) def test_launch_stack_with_parameter_group(self): @@ -441,14 +435,14 @@ class StackTests(test.TestCase): self.assertRegexpMatches(res.content.decode('utf-8'), regex) @test.create_stubs({api.heat: ('stack_update', 'stack_get', - 'template_get', 'template_validate')}) + 'template_get', 'template_validate')}) def test_edit_stack_template(self): template = self.stack_templates.first() stack = self.stacks.first() # GET to template form api.heat.stack_get(IsA(http.HttpRequest), - stack.id).AndReturn(stack) + stack.id).AndReturn(stack) # POST template form, validation api.heat.template_validate(IsA(http.HttpRequest), template=template.data) \ @@ -456,7 +450,7 @@ class StackTests(test.TestCase): # GET to edit form api.heat.stack_get(IsA(http.HttpRequest), - stack.id).AndReturn(stack) + stack.id).AndReturn(stack) api.heat.template_get(IsA(http.HttpRequest), stack.id) \ .AndReturn(json.loads(template.validate)) diff --git a/openstack_dashboard/dashboards/project/volumes/backups/tables.py b/openstack_dashboard/dashboards/project/volumes/backups/tables.py index 37ec0c2b18..0e426163a6 100644 --- a/openstack_dashboard/dashboards/project/volumes/backups/tables.py +++ b/openstack_dashboard/dashboards/project/volumes/backups/tables.py @@ -85,7 +85,7 @@ class UpdateRow(tables.Row): backup = cinder.volume_backup_get(request, backup_id) try: backup.volume = cinder.volume_get(request, - backup.volume_id) + backup.volume_id) except Exception: pass return backup diff --git a/openstack_dashboard/dashboards/project/volumes/backups/tests.py b/openstack_dashboard/dashboards/project/volumes/backups/tests.py index 651b79f5a3..22ca003445 100644 --- a/openstack_dashboard/dashboards/project/volumes/backups/tests.py +++ b/openstack_dashboard/dashboards/project/volumes/backups/tests.py @@ -35,7 +35,7 @@ class VolumeBackupsViewTests(test.TestCase): backup.container_name, backup.name, backup.description) \ - .AndReturn(backup) + .AndReturn(backup) self.mox.ReplayAll() formData = {'method': 'CreateBackupForm', diff --git a/openstack_dashboard/dashboards/project/volumes/volumes/forms.py b/openstack_dashboard/dashboards/project/volumes/volumes/forms.py index 6e9691eaba..b890ba9259 100644 --- a/openstack_dashboard/dashboards/project/volumes/volumes/forms.py +++ b/openstack_dashboard/dashboards/project/volumes/volumes/forms.py @@ -135,18 +135,18 @@ class CreateForm(forms.SelfHandlingForm): self.fields['name'].initial = image.name min_vol_size = functions.bytes_to_gigabytes( image.size) - size_help_text = _('Volume size must be equal to or greater ' - 'than the image size (%s)') \ - % filesizeformat(image.size) + size_help_text = (_('Volume size must be equal to or greater ' + 'than the image size (%s)') + % filesizeformat(image.size)) properties = getattr(image, 'properties', {}) - min_disk_size = getattr(image, 'min_disk', 0) or \ - properties.get('min_disk', 0) + min_disk_size = (getattr(image, 'min_disk', 0) or + properties.get('min_disk', 0)) if (min_disk_size > min_vol_size): min_vol_size = min_disk_size - size_help_text = _('Volume size must be equal to or ' - 'greater than the image minimum ' - 'disk size (%sGB)') \ - % min_disk_size + size_help_text = (_('Volume size must be equal to or ' + 'greater than the image minimum ' + 'disk size (%sGB)') + % min_disk_size) self.fields['size'].initial = min_vol_size self.fields['size'].help_text = size_help_text self.fields['image_source'].choices = ((image.id, image),) @@ -170,9 +170,9 @@ class CreateForm(forms.SelfHandlingForm): self.fields['name'].initial = volume.name self.fields['description'].initial = volume.description min_vol_size = volume.size - size_help_text = _('Volume size must be equal to or greater ' - 'than the origin volume size (%s)') \ - % filesizeformat(volume.size) + size_help_text = (_('Volume size must be equal to or greater ' + 'than the origin volume size (%s)') + % filesizeformat(volume.size)) self.fields['size'].initial = min_vol_size self.fields['size'].help_text = size_help_text self.fields['volume_source'].choices = ((volume.id, volume),) @@ -188,7 +188,7 @@ class CreateForm(forms.SelfHandlingForm): try: snapshot_list = cinder.volume_snapshot_list(request) snapshots = [s for s in snapshot_list - if s.status == 'available'] + if s.status == 'available'] if snapshots: source_type_choices.append(("snapshot_source", _("Snapshot"))) @@ -227,7 +227,7 @@ class CreateForm(forms.SelfHandlingForm): if source_type_choices: choices = ([('no_source_type', _("No source, empty volume"))] + - source_type_choices) + source_type_choices) self.fields['volume_source_type'].choices = choices else: del self.fields['volume_source_type'] @@ -265,7 +265,7 @@ class CreateForm(forms.SelfHandlingForm): try: zones = api.cinder.availability_zone_list(request) zone_list = [(zone.zoneName, zone.zoneName) - for zone in zones if zone.zoneState['available']] + for zone in zones if zone.zoneState['available']] zone_list.sort() except Exception: exceptions.handle(request, _('Unable to retrieve availability ' @@ -302,7 +302,7 @@ class CreateForm(forms.SelfHandlingForm): source_type = data.get('volume_source_type', None) az = data.get('availability_zone', None) or None if (data.get("snapshot_source", None) and - source_type in [None, 'snapshot_source']): + source_type in [None, 'snapshot_source']): # Create from Snapshot snapshot = self.get_snapshot(request, data["snapshot_source"]) @@ -324,8 +324,8 @@ class CreateForm(forms.SelfHandlingForm): 'the image size (%s)') % filesizeformat(image.size) raise ValidationError(error_message) properties = getattr(image, 'properties', {}) - min_disk_size = getattr(image, 'min_disk', 0) or \ - properties.get('min_disk', 0) + min_disk_size = (getattr(image, 'min_disk', 0) or + properties.get('min_disk', 0)) if (min_disk_size > 0 and data['size'] < min_disk_size): error_message = _('The volume size cannot be less than ' 'the image minimum disk size (%sGB)') % min_disk_size @@ -456,9 +456,9 @@ class AttachForm(forms.SelfHandlingForm): data.get('device', '')) volume = cinder.volume_get(request, data['volume_id']) message = _('Attaching volume %(vol)s to instance ' - '%(inst)s on %(dev)s.') % {"vol": volume.name, - "inst": instance_name, - "dev": attach.device} + '%(inst)s on %(dev)s.') % {"vol": volume.name, + "inst": instance_name, + "dev": attach.device} messages.info(request, message) return True except Exception: @@ -550,8 +550,8 @@ class UploadToImageForm(forms.SelfHandlingForm): # I can only use 'raw', 'vmdk', 'vdi' or 'qcow2' so qemu-img will not # have issues when processes image request from cinder. disk_format_choices = [(value, name) for value, name - in IMAGE_FORMAT_CHOICES - if value in VALID_DISK_FORMATS] + in IMAGE_FORMAT_CHOICES + if value in VALID_DISK_FORMATS] self.fields['disk_format'].choices = disk_format_choices self.fields['disk_format'].initial = 'raw' if self.initial['status'] != 'in-use': @@ -654,7 +654,7 @@ class RetypeForm(forms.SelfHandlingForm): try: volume_types = cinder.volume_type_list(request) self.fields['volume_type'].choices = [(t.name, t.name) - for t in volume_types] + for t in volume_types] self.fields['volume_type'].initial = self.initial['volume_type'] except Exception: diff --git a/openstack_dashboard/dashboards/project/volumes/volumes/tables.py b/openstack_dashboard/dashboards/project/volumes/volumes/tables.py index 43f0bba406..0c3abb1be8 100644 --- a/openstack_dashboard/dashboards/project/volumes/volumes/tables.py +++ b/openstack_dashboard/dashboards/project/volumes/volumes/tables.py @@ -189,7 +189,7 @@ class CreateSnapshot(VolumePolicyTargetMixin, tables.LinkAction): if snapshots_available <= 0 and "disabled" not in self.classes: self.classes = [c for c in self.classes] + ['disabled'] self.verbose_name = string_concat(self.verbose_name, ' ', - _("(Quota exceeded)")) + _("(Quota exceeded)")) return volume.status in ("available", "in-use") @@ -217,8 +217,8 @@ class UploadToImage(VolumePolicyTargetMixin, tables.LinkAction): has_image_service_perm = \ request.user.has_perm('openstack.services.image') - return volume.status in ("available", "in-use") and \ - has_image_service_perm + return (volume.status in ("available", "in-use") and + has_image_service_perm) class EditVolume(VolumePolicyTargetMixin, tables.LinkAction): diff --git a/openstack_dashboard/dashboards/project/volumes/volumes/tests.py b/openstack_dashboard/dashboards/project/volumes/volumes/tests.py index ec304a2aae..69b2e4be3e 100644 --- a/openstack_dashboard/dashboards/project/volumes/volumes/tests.py +++ b/openstack_dashboard/dashboards/project/volumes/volumes/tests.py @@ -62,19 +62,19 @@ class VolumeViewTests(test.TestCase): 'availability_zone': az} cinder.volume_type_list(IsA(http.HttpRequest)).\ - AndReturn(self.volume_types.list()) + AndReturn(self.volume_types.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) cinder.volume_snapshot_list(IsA(http.HttpRequest)).\ AndReturn(self.cinder_volume_snapshots.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) cinder.availability_zone_list(IsA(http.HttpRequest)).AndReturn( self.cinder_availability_zones.list()) @@ -127,21 +127,21 @@ class VolumeViewTests(test.TestCase): 'image_source': self.images.first().id} cinder.volume_type_list(IsA(http.HttpRequest)).\ - AndReturn(self.volume_types.list()) + AndReturn(self.volume_types.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)).\ - AndReturn(self.cinder_volume_snapshots.list()) + AndReturn(self.cinder_volume_snapshots.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) cinder.volume_list(IsA( http.HttpRequest)).AndReturn(self.cinder_volumes.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) cinder.extension_supported(IsA(http.HttpRequest), 'AvailabilityZones')\ .AndReturn(True) @@ -187,13 +187,13 @@ class VolumeViewTests(test.TestCase): 'snapshot_source': snapshot.id} cinder.volume_type_list(IsA(http.HttpRequest)).\ - AndReturn(self.volume_types.list()) + AndReturn(self.volume_types.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) cinder.volume_snapshot_get(IsA(http.HttpRequest), str(snapshot.id)).AndReturn(snapshot) cinder.volume_get(IsA(http.HttpRequest), snapshot.volume_id).\ - AndReturn(self.cinder_volumes.first()) + AndReturn(self.cinder_volumes.first()) cinder.volume_create(IsA(http.HttpRequest), formData['size'], @@ -242,13 +242,13 @@ class VolumeViewTests(test.TestCase): 'volume_source': volume.id} cinder.volume_list(IsA(http.HttpRequest)).\ - AndReturn(self.cinder_volumes.list()) + AndReturn(self.cinder_volumes.list()) cinder.volume_type_list(IsA(http.HttpRequest)).\ - AndReturn(self.volume_types.list()) + AndReturn(self.volume_types.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)).\ - AndReturn(self.cinder_volume_snapshots.list()) + AndReturn(self.cinder_volume_snapshots.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) cinder.volume_get(IsA(http.HttpRequest), volume.id).AndReturn(self.cinder_volumes.first()) @@ -259,11 +259,11 @@ class VolumeViewTests(test.TestCase): api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) cinder.volume_create(IsA(http.HttpRequest), formData['size'], @@ -310,21 +310,21 @@ class VolumeViewTests(test.TestCase): 'snapshot_source': snapshot.id} cinder.volume_type_list(IsA(http.HttpRequest)).\ - AndReturn(self.volume_types.list()) + AndReturn(self.volume_types.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)).\ - AndReturn(self.cinder_volume_snapshots.list()) + AndReturn(self.cinder_volume_snapshots.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) cinder.volume_list(IsA( http.HttpRequest)).AndReturn(self.cinder_volumes.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) cinder.volume_snapshot_get(IsA(http.HttpRequest), str(snapshot.id)).AndReturn(snapshot) @@ -370,16 +370,16 @@ class VolumeViewTests(test.TestCase): 'size': 20, 'snapshot_source': snapshot.id} cinder.volume_type_list(IsA(http.HttpRequest)).\ - AndReturn(self.volume_types.list()) + AndReturn(self.volume_types.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) cinder.volume_snapshot_get(IsA(http.HttpRequest), str(snapshot.id)).AndReturn(snapshot) cinder.volume_get(IsA(http.HttpRequest), snapshot.volume_id).\ - AndReturn(self.cinder_volumes.first()) + AndReturn(self.cinder_volumes.first()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) self.mox.ReplayAll() @@ -413,9 +413,9 @@ class VolumeViewTests(test.TestCase): 'image_source': image.id} cinder.volume_type_list(IsA(http.HttpRequest)).\ - AndReturn(self.volume_types.list()) + AndReturn(self.volume_types.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) api.glance.image_get(IsA(http.HttpRequest), str(image.id)).AndReturn(image) @@ -472,21 +472,21 @@ class VolumeViewTests(test.TestCase): 'image_source': image.id} cinder.volume_type_list(IsA(http.HttpRequest)).\ - AndReturn(self.volume_types.list()) + AndReturn(self.volume_types.list()) cinder.volume_snapshot_list(IsA(http.HttpRequest)).\ - AndReturn(self.cinder_volume_snapshots.list()) + AndReturn(self.cinder_volume_snapshots.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) cinder.volume_list(IsA( http.HttpRequest)).AndReturn(self.cinder_volumes.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)) \ - .AndReturn(usage_limit) + .AndReturn(usage_limit) api.glance.image_get(IsA(http.HttpRequest), str(image.id)).AndReturn(image) @@ -533,9 +533,9 @@ class VolumeViewTests(test.TestCase): 'size': 1, 'image_source': image.id} cinder.volume_type_list(IsA(http.HttpRequest)).\ - AndReturn(self.volume_types.list()) + AndReturn(self.volume_types.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) api.glance.image_get(IsA(http.HttpRequest), str(image.id)).AndReturn(image) cinder.extension_supported(IsA(http.HttpRequest), 'AvailabilityZones')\ @@ -543,7 +543,7 @@ class VolumeViewTests(test.TestCase): cinder.availability_zone_list(IsA(http.HttpRequest)).AndReturn( self.cinder_availability_zones.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) self.mox.ReplayAll() @@ -581,9 +581,9 @@ class VolumeViewTests(test.TestCase): 'size': 5, 'image_source': image.id} cinder.volume_type_list(IsA(http.HttpRequest)).\ - AndReturn(self.volume_types.list()) + AndReturn(self.volume_types.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) api.glance.image_get(IsA(http.HttpRequest), str(image.id)).AndReturn(image) cinder.extension_supported(IsA(http.HttpRequest), 'AvailabilityZones')\ @@ -591,7 +591,7 @@ class VolumeViewTests(test.TestCase): cinder.availability_zone_list(IsA(http.HttpRequest)).AndReturn( self.cinder_availability_zones.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) self.mox.ReplayAll() @@ -633,19 +633,19 @@ class VolumeViewTests(test.TestCase): 'size': 5000} cinder.volume_type_list(IsA(http.HttpRequest)).\ - AndReturn(self.volume_types.list()) + AndReturn(self.volume_types.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) cinder.volume_snapshot_list(IsA(http.HttpRequest)).\ AndReturn(self.cinder_volume_snapshots.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) cinder.volume_list(IsA( http.HttpRequest)).AndReturn(self.cinder_volumes.list()) cinder.extension_supported(IsA(http.HttpRequest), 'AvailabilityZones')\ @@ -653,7 +653,7 @@ class VolumeViewTests(test.TestCase): cinder.availability_zone_list(IsA(http.HttpRequest)).AndReturn( self.cinder_availability_zones.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) self.mox.ReplayAll() @@ -682,19 +682,19 @@ class VolumeViewTests(test.TestCase): 'size': 10} cinder.volume_type_list(IsA(http.HttpRequest)).\ - AndReturn(self.volume_types.list()) + AndReturn(self.volume_types.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) cinder.volume_snapshot_list(IsA(http.HttpRequest)).\ AndReturn(self.cinder_volume_snapshots.list()) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'is_public': True, 'status': 'active'}) \ - .AndReturn([self.images.list(), False, False]) + .AndReturn([self.images.list(), False, False]) api.glance.image_list_detailed(IsA(http.HttpRequest), filters={'property-owner_id': self.tenant.id, 'status': 'active'}) \ - .AndReturn([[], False, False]) + .AndReturn([[], False, False]) cinder.volume_list(IsA( http.HttpRequest)).AndReturn(self.cinder_volumes.list()) cinder.extension_supported(IsA(http.HttpRequest), 'AvailabilityZones')\ @@ -702,7 +702,7 @@ class VolumeViewTests(test.TestCase): cinder.availability_zone_list(IsA(http.HttpRequest)).AndReturn( self.cinder_availability_zones.list()) quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ - AndReturn(usage_limit) + AndReturn(usage_limit) self.mox.ReplayAll() @@ -761,17 +761,17 @@ class VolumeViewTests(test.TestCase): cinder.volume_backup_supported(IsA(http.HttpRequest)). \ MultipleTimes().AndReturn(True) cinder.volume_list(IsA(http.HttpRequest), search_opts=None).\ - AndReturn(volumes) + AndReturn(volumes) cinder.volume_delete(IsA(http.HttpRequest), volume.id).\ - AndRaise(exc) + AndRaise(exc) api.nova.server_list(IsA(http.HttpRequest), search_opts=None).\ - AndReturn([self.servers.list(), False]) + AndReturn([self.servers.list(), False]) cinder.volume_list(IsA(http.HttpRequest), search_opts=None).\ - AndReturn(volumes) + AndReturn(volumes) api.nova.server_list(IsA(http.HttpRequest), search_opts=None).\ - AndReturn([self.servers.list(), False]) + AndReturn([self.servers.list(), False]) cinder.tenant_absolute_limits(IsA(http.HttpRequest)).MultipleTimes().\ - AndReturn(self.cinder_limits['absolute']) + AndReturn(self.cinder_limits['absolute']) self.mox.ReplayAll() url = VOLUME_INDEX_URL @@ -868,9 +868,9 @@ class VolumeViewTests(test.TestCase): volume = self.cinder_volumes.list()[0] cinder.volume_get(IsA(http.HttpRequest), volume.id) \ - .AndReturn(volume) + .AndReturn(volume) api.nova.server_list(IsA(http.HttpRequest)) \ - .AndReturn([servers, False]) + .AndReturn([servers, False]) self.mox.ReplayAll() @@ -899,14 +899,14 @@ class VolumeViewTests(test.TestCase): create_link = tables.CreateSnapshot() url = reverse(create_link.get_link_url(), args=[volume.id]) - res_url = VOLUME_INDEX_URL + \ - "?action=row_update&table=volumes&obj_id=" + volume.id + res_url = (VOLUME_INDEX_URL + + "?action=row_update&table=volumes&obj_id=" + volume.id) res = self.client.get(res_url, {}, - HTTP_X_REQUESTED_WITH='XMLHttpRequest') + HTTP_X_REQUESTED_WITH='XMLHttpRequest') - classes = list(create_link.get_default_classes())\ - + list(create_link.classes) + classes = (list(create_link.get_default_classes()) + + list(create_link.classes)) link_name = "%s (%s)" % (unicode(create_link.verbose_name), "Quota exceeded") expected_string = "