From db1789e82b8ff60c5c2cc8d6699b26ef53f225e1 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 23 May 2019 10:13:12 +0100 Subject: [PATCH] Ensure controllers all call super Currently some do and some don't. Do it by default as intended. We also remove the 'view_builder' argument from the base 'Controller.__init__' function since nothing was actually setting this. Change-Id: Ic0b16608078e4545f546509df94caba3166ed6e2 Signed-off-by: Stephen Finucane --- nova/api/openstack/compute/admin_actions.py | 4 ++-- nova/api/openstack/compute/admin_password.py | 4 ++-- nova/api/openstack/compute/aggregates.py | 5 +++-- nova/api/openstack/compute/assisted_volume_snapshots.py | 2 +- nova/api/openstack/compute/attach_interfaces.py | 2 +- nova/api/openstack/compute/console_auth_tokens.py | 4 ++-- nova/api/openstack/compute/console_output.py | 4 ++-- nova/api/openstack/compute/consoles.py | 1 + nova/api/openstack/compute/create_backup.py | 4 ++-- nova/api/openstack/compute/deferred_delete.py | 4 ++-- nova/api/openstack/compute/evacuate.py | 4 ++-- nova/api/openstack/compute/flavor_manage.py | 3 --- nova/api/openstack/compute/floating_ip_pools.py | 2 +- nova/api/openstack/compute/floating_ips.py | 6 +++--- nova/api/openstack/compute/hosts.py | 2 +- nova/api/openstack/compute/hypervisors.py | 2 +- nova/api/openstack/compute/image_metadata.py | 1 + nova/api/openstack/compute/images.py | 4 ++-- nova/api/openstack/compute/instance_usage_audit_log.py | 2 ++ nova/api/openstack/compute/ips.py | 4 ++-- nova/api/openstack/compute/keypairs.py | 2 +- nova/api/openstack/compute/lock_server.py | 4 ++-- nova/api/openstack/compute/migrate_server.py | 4 ++-- nova/api/openstack/compute/multinic.py | 4 ++-- nova/api/openstack/compute/networks.py | 2 ++ nova/api/openstack/compute/networks_associate.py | 2 ++ nova/api/openstack/compute/pause_server.py | 4 ++-- nova/api/openstack/compute/quota_classes.py | 3 ++- nova/api/openstack/compute/remote_consoles.py | 4 ++-- nova/api/openstack/compute/rescue.py | 4 ++-- nova/api/openstack/compute/security_group_default_rules.py | 1 + nova/api/openstack/compute/security_groups.py | 5 +++-- nova/api/openstack/compute/server_diagnostics.py | 4 ++-- nova/api/openstack/compute/server_external_events.py | 2 +- nova/api/openstack/compute/server_metadata.py | 2 +- nova/api/openstack/compute/server_migrations.py | 2 +- nova/api/openstack/compute/server_password.py | 1 + nova/api/openstack/compute/server_tags.py | 2 +- nova/api/openstack/compute/servers.py | 5 ++--- nova/api/openstack/compute/services.py | 1 + nova/api/openstack/compute/shelve.py | 4 ++-- nova/api/openstack/compute/suspend_server.py | 4 ++-- nova/api/openstack/compute/tenant_networks.py | 2 ++ nova/api/openstack/compute/volumes.py | 2 +- nova/api/openstack/wsgi.py | 6 ++---- 45 files changed, 75 insertions(+), 65 deletions(-) diff --git a/nova/api/openstack/compute/admin_actions.py b/nova/api/openstack/compute/admin_actions.py index 9db60fc6d512..1873dabe393f 100644 --- a/nova/api/openstack/compute/admin_actions.py +++ b/nova/api/openstack/compute/admin_actions.py @@ -30,8 +30,8 @@ state_map = dict(active=vm_states.ACTIVE, error=vm_states.ERROR) class AdminActionsController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(AdminActionsController, self).__init__(*args, **kwargs) + def __init__(self): + super(AdminActionsController, self).__init__() self.compute_api = compute.API() @wsgi.response(202) diff --git a/nova/api/openstack/compute/admin_password.py b/nova/api/openstack/compute/admin_password.py index 7f9410e7833b..36c6cbcf1e5a 100644 --- a/nova/api/openstack/compute/admin_password.py +++ b/nova/api/openstack/compute/admin_password.py @@ -26,8 +26,8 @@ from nova.policies import admin_password as ap_policies class AdminPasswordController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(AdminPasswordController, self).__init__(*args, **kwargs) + def __init__(self): + super(AdminPasswordController, self).__init__() self.compute_api = compute.API() # TODO(eliqiao): Here should be 204(No content) instead of 202 by v2.1+ diff --git a/nova/api/openstack/compute/aggregates.py b/nova/api/openstack/compute/aggregates.py index e44b449e7661..7f2e29d45a52 100644 --- a/nova/api/openstack/compute/aggregates.py +++ b/nova/api/openstack/compute/aggregates.py @@ -24,7 +24,7 @@ from nova.api.openstack import common from nova.api.openstack.compute.schemas import aggregates from nova.api.openstack import wsgi from nova.api import validation -from nova.compute import api as compute_api +from nova.compute import api as compute from nova import exception from nova.i18n import _ from nova.policies import aggregates as aggr_policies @@ -37,7 +37,8 @@ def _get_context(req): class AggregateController(wsgi.Controller): """The Host Aggregates API controller for the OpenStack API.""" def __init__(self): - self.api = compute_api.AggregateAPI() + super(AggregateController, self).__init__() + self.api = compute.AggregateAPI() @wsgi.expected_errors(()) def index(self, req): diff --git a/nova/api/openstack/compute/assisted_volume_snapshots.py b/nova/api/openstack/compute/assisted_volume_snapshots.py index b946ce795738..29039a09cca4 100644 --- a/nova/api/openstack/compute/assisted_volume_snapshots.py +++ b/nova/api/openstack/compute/assisted_volume_snapshots.py @@ -32,8 +32,8 @@ class AssistedVolumeSnapshotsController(wsgi.Controller): """The Assisted volume snapshots API controller for the OpenStack API.""" def __init__(self): - self.compute_api = compute.API() super(AssistedVolumeSnapshotsController, self).__init__() + self.compute_api = compute.API() @wsgi.expected_errors(400) @validation.schema(assisted_volume_snapshots.snapshots_create) diff --git a/nova/api/openstack/compute/attach_interfaces.py b/nova/api/openstack/compute/attach_interfaces.py index 465cee410687..1230e65591c7 100644 --- a/nova/api/openstack/compute/attach_interfaces.py +++ b/nova/api/openstack/compute/attach_interfaces.py @@ -59,9 +59,9 @@ class InterfaceAttachmentController(wsgi.Controller): """The interface attachment API controller for the OpenStack API.""" def __init__(self): + super(InterfaceAttachmentController, self).__init__() self.compute_api = compute.API() self.network_api = network.API() - super(InterfaceAttachmentController, self).__init__() @wsgi.expected_errors((404, 501)) def index(self, req, server_id): diff --git a/nova/api/openstack/compute/console_auth_tokens.py b/nova/api/openstack/compute/console_auth_tokens.py index a85b6a35424e..e8066b1f8d57 100644 --- a/nova/api/openstack/compute/console_auth_tokens.py +++ b/nova/api/openstack/compute/console_auth_tokens.py @@ -27,9 +27,9 @@ CONF = nova.conf.CONF class ConsoleAuthTokensController(wsgi.Controller): - def __init__(self, *args, **kwargs): + def __init__(self): + super(ConsoleAuthTokensController, self).__init__() self._consoleauth_rpcapi = consoleauth_rpcapi.ConsoleAuthAPI() - super(ConsoleAuthTokensController, self).__init__(*args, **kwargs) def _show(self, req, id, rdp_only): """Checks a console auth token and returns the related connect info.""" diff --git a/nova/api/openstack/compute/console_output.py b/nova/api/openstack/compute/console_output.py index fb5985534859..93285cc55c77 100644 --- a/nova/api/openstack/compute/console_output.py +++ b/nova/api/openstack/compute/console_output.py @@ -28,8 +28,8 @@ from nova.policies import console_output as co_policies class ConsoleOutputController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(ConsoleOutputController, self).__init__(*args, **kwargs) + def __init__(self): + super(ConsoleOutputController, self).__init__() self.compute_api = compute.API() @wsgi.expected_errors((404, 409, 501)) diff --git a/nova/api/openstack/compute/consoles.py b/nova/api/openstack/compute/consoles.py index 3e332d78f97f..f83f3bea7146 100644 --- a/nova/api/openstack/compute/consoles.py +++ b/nova/api/openstack/compute/consoles.py @@ -45,6 +45,7 @@ class ConsolesController(wsgi.Controller): """The Consoles controller for the OpenStack API.""" def __init__(self): + super(ConsolesController, self).__init__() self.console_api = console_api.API() @wsgi.expected_errors(()) diff --git a/nova/api/openstack/compute/create_backup.py b/nova/api/openstack/compute/create_backup.py index 482522ca8dad..3ae8037c8099 100644 --- a/nova/api/openstack/compute/create_backup.py +++ b/nova/api/openstack/compute/create_backup.py @@ -26,8 +26,8 @@ from nova.policies import create_backup as cb_policies class CreateBackupController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(CreateBackupController, self).__init__(*args, **kwargs) + def __init__(self): + super(CreateBackupController, self).__init__() self.compute_api = compute.API() @wsgi.response(202) diff --git a/nova/api/openstack/compute/deferred_delete.py b/nova/api/openstack/compute/deferred_delete.py index cdd42c966e9c..0001c9942da1 100644 --- a/nova/api/openstack/compute/deferred_delete.py +++ b/nova/api/openstack/compute/deferred_delete.py @@ -25,8 +25,8 @@ from nova.policies import deferred_delete as dd_policies class DeferredDeleteController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(DeferredDeleteController, self).__init__(*args, **kwargs) + def __init__(self): + super(DeferredDeleteController, self).__init__() self.compute_api = compute.API() @wsgi.response(202) diff --git a/nova/api/openstack/compute/evacuate.py b/nova/api/openstack/compute/evacuate.py index 7f003f27feab..180da2a0d19a 100644 --- a/nova/api/openstack/compute/evacuate.py +++ b/nova/api/openstack/compute/evacuate.py @@ -33,8 +33,8 @@ CONF = nova.conf.CONF class EvacuateController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(EvacuateController, self).__init__(*args, **kwargs) + def __init__(self): + super(EvacuateController, self).__init__() self.compute_api = compute.API() self.host_api = compute.HostAPI() self.network_api = network.API() diff --git a/nova/api/openstack/compute/flavor_manage.py b/nova/api/openstack/compute/flavor_manage.py index 44c72bb8b4e2..abd7a7f72638 100644 --- a/nova/api/openstack/compute/flavor_manage.py +++ b/nova/api/openstack/compute/flavor_manage.py @@ -28,9 +28,6 @@ class FlavorManageController(wsgi.Controller): """The Flavor Lifecycle API controller for the OpenStack API.""" _view_builder_class = flavors_view.ViewBuilder - def __init__(self): - super(FlavorManageController, self).__init__() - # NOTE(oomichi): Return 202 for backwards compatibility but should be # 204 as this operation complete the deletion of aggregate resource and # return no response body. diff --git a/nova/api/openstack/compute/floating_ip_pools.py b/nova/api/openstack/compute/floating_ip_pools.py index d0b4690f0dc5..0c0ea0cb7580 100644 --- a/nova/api/openstack/compute/floating_ip_pools.py +++ b/nova/api/openstack/compute/floating_ip_pools.py @@ -36,8 +36,8 @@ class FloatingIPPoolsController(wsgi.Controller): """The Floating IP Pool API controller for the OpenStack API.""" def __init__(self): - self.network_api = network.API() super(FloatingIPPoolsController, self).__init__() + self.network_api = network.API() @wsgi.Controller.api_version("2.1", MAX_PROXY_API_SUPPORT_VERSION) @wsgi.expected_errors(()) diff --git a/nova/api/openstack/compute/floating_ips.py b/nova/api/openstack/compute/floating_ips.py index 70dea4d91574..d27185f7ee2e 100644 --- a/nova/api/openstack/compute/floating_ips.py +++ b/nova/api/openstack/compute/floating_ips.py @@ -106,9 +106,9 @@ class FloatingIPController(wsgi.Controller): """The Floating IPs API controller for the OpenStack API.""" def __init__(self): + super(FloatingIPController, self).__init__() self.compute_api = compute.API() self.network_api = network.API() - super(FloatingIPController, self).__init__() @wsgi.Controller.api_version("2.1", MAX_PROXY_API_SUPPORT_VERSION) @wsgi.expected_errors((400, 404)) @@ -204,8 +204,8 @@ class FloatingIPController(wsgi.Controller): class FloatingIPActionController(wsgi.Controller): """This API is deprecated from the Microversion '2.44'.""" - def __init__(self, *args, **kwargs): - super(FloatingIPActionController, self).__init__(*args, **kwargs) + def __init__(self): + super(FloatingIPActionController, self).__init__() self.compute_api = compute.API() self.network_api = network.API() diff --git a/nova/api/openstack/compute/hosts.py b/nova/api/openstack/compute/hosts.py index 26c2f8a7da18..31424b24b08a 100644 --- a/nova/api/openstack/compute/hosts.py +++ b/nova/api/openstack/compute/hosts.py @@ -35,8 +35,8 @@ LOG = logging.getLogger(__name__) class HostController(wsgi.Controller): """The Hosts API controller for the OpenStack API.""" def __init__(self): - self.api = compute.HostAPI() super(HostController, self).__init__() + self.api = compute.HostAPI() @wsgi.Controller.api_version("2.1", "2.42") @validation.query_schema(hosts.index_query) diff --git a/nova/api/openstack/compute/hypervisors.py b/nova/api/openstack/compute/hypervisors.py index 7d5435d0993f..a9184edb1810 100644 --- a/nova/api/openstack/compute/hypervisors.py +++ b/nova/api/openstack/compute/hypervisors.py @@ -45,9 +45,9 @@ class HypervisorsController(wsgi.Controller): _view_builder_class = hyper_view.ViewBuilder def __init__(self): + super(HypervisorsController, self).__init__() self.host_api = compute.HostAPI() self.servicegroup_api = servicegroup.API() - super(HypervisorsController, self).__init__() def _view_hypervisor(self, hypervisor, service, detail, req, servers=None, **kwargs): diff --git a/nova/api/openstack/compute/image_metadata.py b/nova/api/openstack/compute/image_metadata.py index f7071061849b..873e5efd8617 100644 --- a/nova/api/openstack/compute/image_metadata.py +++ b/nova/api/openstack/compute/image_metadata.py @@ -31,6 +31,7 @@ class ImageMetadataController(wsgi.Controller): """The image metadata API controller for the OpenStack API.""" def __init__(self): + super(ImageMetadataController, self).__init__() self.image_api = nova.image.API() def _get_image(self, context, image_id): diff --git a/nova/api/openstack/compute/images.py b/nova/api/openstack/compute/images.py index f2fb243145b5..0adcc6dec5e1 100644 --- a/nova/api/openstack/compute/images.py +++ b/nova/api/openstack/compute/images.py @@ -42,8 +42,8 @@ class ImagesController(wsgi.Controller): _view_builder_class = views_images.ViewBuilder - def __init__(self, **kwargs): - super(ImagesController, self).__init__(**kwargs) + def __init__(self): + super(ImagesController, self).__init__() self._image_api = nova.image.API() def _get_filters(self, req): diff --git a/nova/api/openstack/compute/instance_usage_audit_log.py b/nova/api/openstack/compute/instance_usage_audit_log.py index f623a5ad1025..93d39136b2b3 100644 --- a/nova/api/openstack/compute/instance_usage_audit_log.py +++ b/nova/api/openstack/compute/instance_usage_audit_log.py @@ -27,7 +27,9 @@ from nova import utils class InstanceUsageAuditLogController(wsgi.Controller): + def __init__(self): + super(InstanceUsageAuditLogController, self).__init__() self.host_api = compute.HostAPI() @wsgi.expected_errors(()) diff --git a/nova/api/openstack/compute/ips.py b/nova/api/openstack/compute/ips.py index 9a2bccd9f7d1..858340435258 100644 --- a/nova/api/openstack/compute/ips.py +++ b/nova/api/openstack/compute/ips.py @@ -31,8 +31,8 @@ class IPsController(wsgi.Controller): # microversion by using V2.1 view builder. _view_builder_class = views_addresses.ViewBuilder - def __init__(self, **kwargs): - super(IPsController, self).__init__(**kwargs) + def __init__(self): + super(IPsController, self).__init__() self._compute_api = compute.API() @wsgi.expected_errors(404) diff --git a/nova/api/openstack/compute/keypairs.py b/nova/api/openstack/compute/keypairs.py index 34ca12d6985c..b3dec117f781 100644 --- a/nova/api/openstack/compute/keypairs.py +++ b/nova/api/openstack/compute/keypairs.py @@ -38,8 +38,8 @@ class KeypairController(wsgi.Controller): _view_builder_class = keypairs_view.ViewBuilder def __init__(self): - self.api = compute_api.KeypairAPI() super(KeypairController, self).__init__() + self.api = compute_api.KeypairAPI() def _filter_keypair(self, keypair, **attrs): # TODO(claudiub): After v2 and v2.1 is no longer supported, diff --git a/nova/api/openstack/compute/lock_server.py b/nova/api/openstack/compute/lock_server.py index ba770c9f702d..71ea8408efdb 100644 --- a/nova/api/openstack/compute/lock_server.py +++ b/nova/api/openstack/compute/lock_server.py @@ -23,8 +23,8 @@ from nova.policies import lock_server as ls_policies class LockServerController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(LockServerController, self).__init__(*args, **kwargs) + def __init__(self): + super(LockServerController, self).__init__() self.compute_api = compute.API() @wsgi.response(202) diff --git a/nova/api/openstack/compute/migrate_server.py b/nova/api/openstack/compute/migrate_server.py index 05d3210c7f87..3a3f84158f92 100644 --- a/nova/api/openstack/compute/migrate_server.py +++ b/nova/api/openstack/compute/migrate_server.py @@ -33,8 +33,8 @@ LOG = logging.getLogger(__name__) class MigrateServerController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(MigrateServerController, self).__init__(*args, **kwargs) + def __init__(self): + super(MigrateServerController, self).__init__() self.compute_api = compute.API() self.network_api = network.API() diff --git a/nova/api/openstack/compute/multinic.py b/nova/api/openstack/compute/multinic.py index 2b7c222d57ba..89e9b01e02eb 100644 --- a/nova/api/openstack/compute/multinic.py +++ b/nova/api/openstack/compute/multinic.py @@ -29,8 +29,8 @@ from nova.policies import multinic as multinic_policies class MultinicController(wsgi.Controller): """This API is deprecated from Microversion '2.44'.""" - def __init__(self, *args, **kwargs): - super(MultinicController, self).__init__(*args, **kwargs) + def __init__(self): + super(MultinicController, self).__init__() self.compute_api = compute.API() @wsgi.Controller.api_version("2.1", "2.43") diff --git a/nova/api/openstack/compute/networks.py b/nova/api/openstack/compute/networks.py index cff450941b4e..efd14253e38c 100644 --- a/nova/api/openstack/compute/networks.py +++ b/nova/api/openstack/compute/networks.py @@ -79,6 +79,8 @@ def network_dict(context, network): class NetworkController(wsgi.Controller): def __init__(self, network_api=None): + super(NetworkController, self).__init__() + # TODO(stephenfin): 'network_api' is only being passed for use by tests self.network_api = network_api or network.API() @wsgi.Controller.api_version("2.1", MAX_PROXY_API_SUPPORT_VERSION) diff --git a/nova/api/openstack/compute/networks_associate.py b/nova/api/openstack/compute/networks_associate.py index 27a128d92c36..b4f0e9a83b76 100644 --- a/nova/api/openstack/compute/networks_associate.py +++ b/nova/api/openstack/compute/networks_associate.py @@ -28,6 +28,8 @@ class NetworkAssociateActionController(wsgi.Controller): """Network Association API Controller.""" def __init__(self, network_api=None): + super(NetworkAssociateActionController, self).__init__() + # TODO(stephenfin): 'network_api' is only being passed for use by tests self.network_api = network_api or network.API() @wsgi.Controller.api_version("2.1", MAX_PROXY_API_SUPPORT_VERSION) diff --git a/nova/api/openstack/compute/pause_server.py b/nova/api/openstack/compute/pause_server.py index 44e1f10bb61f..cc0a186b3662 100644 --- a/nova/api/openstack/compute/pause_server.py +++ b/nova/api/openstack/compute/pause_server.py @@ -23,8 +23,8 @@ from nova.policies import pause_server as ps_policies class PauseServerController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(PauseServerController, self).__init__(*args, **kwargs) + def __init__(self): + super(PauseServerController, self).__init__() self.compute_api = compute.API() @wsgi.response(202) diff --git a/nova/api/openstack/compute/quota_classes.py b/nova/api/openstack/compute/quota_classes.py index 3a0f57bc9675..bc4169b8e412 100644 --- a/nova/api/openstack/compute/quota_classes.py +++ b/nova/api/openstack/compute/quota_classes.py @@ -47,7 +47,8 @@ class QuotaClassSetsController(wsgi.Controller): supported_quotas = [] - def __init__(self, **kwargs): + def __init__(self): + super(QuotaClassSetsController, self).__init__() self.supported_quotas = QUOTAS.resources def _format_quota_set(self, quota_class, quota_set, filtered_quotas=None, diff --git a/nova/api/openstack/compute/remote_consoles.py b/nova/api/openstack/compute/remote_consoles.py index 686ff802ec30..8bf043087b78 100644 --- a/nova/api/openstack/compute/remote_consoles.py +++ b/nova/api/openstack/compute/remote_consoles.py @@ -24,14 +24,14 @@ from nova.policies import remote_consoles as rc_policies class RemoteConsolesController(wsgi.Controller): - def __init__(self, *args, **kwargs): + def __init__(self): + super(RemoteConsolesController, self).__init__() self.compute_api = compute.API() self.handlers = {'vnc': self.compute_api.get_vnc_console, 'spice': self.compute_api.get_spice_console, 'rdp': self.compute_api.get_rdp_console, 'serial': self.compute_api.get_serial_console, 'mks': self.compute_api.get_mks_console} - super(RemoteConsolesController, self).__init__(*args, **kwargs) @wsgi.Controller.api_version("2.1", "2.5") @wsgi.expected_errors((400, 404, 409, 501)) diff --git a/nova/api/openstack/compute/rescue.py b/nova/api/openstack/compute/rescue.py index 683643c9d780..4f83d5365657 100644 --- a/nova/api/openstack/compute/rescue.py +++ b/nova/api/openstack/compute/rescue.py @@ -30,8 +30,8 @@ CONF = nova.conf.CONF class RescueController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(RescueController, self).__init__(*args, **kwargs) + def __init__(self): + super(RescueController, self).__init__() self.compute_api = compute.API() # TODO(cyeoh): Should be responding here with 202 Accept diff --git a/nova/api/openstack/compute/security_group_default_rules.py b/nova/api/openstack/compute/security_group_default_rules.py index d208cd93fd69..358d6e9ae600 100644 --- a/nova/api/openstack/compute/security_group_default_rules.py +++ b/nova/api/openstack/compute/security_group_default_rules.py @@ -28,6 +28,7 @@ class SecurityGroupDefaultRulesController(sg.SecurityGroupControllerBase, wsgi.Controller): def __init__(self): + super(SecurityGroupDefaultRulesController, self).__init__() self.security_group_api = ( openstack_driver.get_openstack_security_group_driver()) diff --git a/nova/api/openstack/compute/security_groups.py b/nova/api/openstack/compute/security_groups.py index 8267cfcba9ef..5ac636947a56 100644 --- a/nova/api/openstack/compute/security_groups.py +++ b/nova/api/openstack/compute/security_groups.py @@ -47,6 +47,7 @@ class SecurityGroupControllerBase(object): """Base class for Security Group controllers.""" def __init__(self): + super(SecurityGroupControllerBase, self).__init__() self.security_group_api = ( openstack_driver.get_openstack_security_group_driver()) self.compute_api = compute.API( @@ -405,8 +406,8 @@ class ServerSecurityGroupController(SecurityGroupControllerBase): class SecurityGroupActionController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(SecurityGroupActionController, self).__init__(*args, **kwargs) + def __init__(self): + super(SecurityGroupActionController, self).__init__() self.security_group_api = ( openstack_driver.get_openstack_security_group_driver()) self.compute_api = compute.API( diff --git a/nova/api/openstack/compute/server_diagnostics.py b/nova/api/openstack/compute/server_diagnostics.py index aab601e05578..f559dd036512 100644 --- a/nova/api/openstack/compute/server_diagnostics.py +++ b/nova/api/openstack/compute/server_diagnostics.py @@ -27,8 +27,8 @@ from nova.policies import server_diagnostics as sd_policies class ServerDiagnosticsController(wsgi.Controller): _view_builder_class = server_diagnostics.ViewBuilder - def __init__(self, *args, **kwargs): - super(ServerDiagnosticsController, self).__init__(*args, **kwargs) + def __init__(self): + super(ServerDiagnosticsController, self).__init__() self.compute_api = compute.API() @wsgi.expected_errors((400, 404, 409, 501)) diff --git a/nova/api/openstack/compute/server_external_events.py b/nova/api/openstack/compute/server_external_events.py index 7236aed6caa6..1b055567540d 100644 --- a/nova/api/openstack/compute/server_external_events.py +++ b/nova/api/openstack/compute/server_external_events.py @@ -31,8 +31,8 @@ LOG = logging.getLogger(__name__) class ServerExternalEventsController(wsgi.Controller): def __init__(self): - self.compute_api = compute.API() super(ServerExternalEventsController, self).__init__() + self.compute_api = compute.API() @staticmethod def _is_event_tag_present_when_required(event): diff --git a/nova/api/openstack/compute/server_metadata.py b/nova/api/openstack/compute/server_metadata.py index b414b86f9b06..ca429029abc3 100644 --- a/nova/api/openstack/compute/server_metadata.py +++ b/nova/api/openstack/compute/server_metadata.py @@ -30,8 +30,8 @@ class ServerMetadataController(wsgi.Controller): """The server metadata API controller for the OpenStack API.""" def __init__(self): - self.compute_api = compute.API() super(ServerMetadataController, self).__init__() + self.compute_api = compute.API() def _get_metadata(self, context, server_id): server = common.get_instance(self.compute_api, context, server_id) diff --git a/nova/api/openstack/compute/server_migrations.py b/nova/api/openstack/compute/server_migrations.py index e3d46c070a6a..6f92ac99bcc2 100644 --- a/nova/api/openstack/compute/server_migrations.py +++ b/nova/api/openstack/compute/server_migrations.py @@ -59,8 +59,8 @@ class ServerMigrationsController(wsgi.Controller): """The server migrations API controller for the OpenStack API.""" def __init__(self): - self.compute_api = compute.API() super(ServerMigrationsController, self).__init__() + self.compute_api = compute.API() @wsgi.Controller.api_version("2.22") @wsgi.response(202) diff --git a/nova/api/openstack/compute/server_password.py b/nova/api/openstack/compute/server_password.py index a837fae01734..1d1bc251db48 100644 --- a/nova/api/openstack/compute/server_password.py +++ b/nova/api/openstack/compute/server_password.py @@ -25,6 +25,7 @@ from nova.policies import server_password as sp_policies class ServerPasswordController(wsgi.Controller): """The Server Password API controller for the OpenStack API.""" def __init__(self): + super(ServerPasswordController, self).__init__() self.compute_api = compute.API() @wsgi.expected_errors(404) diff --git a/nova/api/openstack/compute/server_tags.py b/nova/api/openstack/compute/server_tags.py index 220ef612fe58..d2a00fc2b91e 100644 --- a/nova/api/openstack/compute/server_tags.py +++ b/nova/api/openstack/compute/server_tags.py @@ -45,8 +45,8 @@ class ServerTagsController(wsgi.Controller): _view_builder_class = server_tags.ViewBuilder def __init__(self): - self.compute_api = compute.API() super(ServerTagsController, self).__init__() + self.compute_api = compute.API() def _check_instance_in_valid_state(self, context, server_id, action): instance = common.get_instance(self.compute_api, context, server_id) diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index b037956bb708..5507bce6c6b1 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -104,9 +104,8 @@ class ServersController(wsgi.Controller): # Convenience return return robj - def __init__(self, **kwargs): - - super(ServersController, self).__init__(**kwargs) + def __init__(self): + super(ServersController, self).__init__() self.compute_api = compute.API() self.network_api = network_api.API() diff --git a/nova/api/openstack/compute/services.py b/nova/api/openstack/compute/services.py index 9180c63f4fd0..89531900d2f2 100644 --- a/nova/api/openstack/compute/services.py +++ b/nova/api/openstack/compute/services.py @@ -37,6 +37,7 @@ PARTIAL_CONSTRUCT_FOR_CELL_DOWN_MIN_VERSION = '2.69' class ServiceController(wsgi.Controller): def __init__(self): + super(ServiceController, self).__init__() self.host_api = compute.HostAPI() self.aggregate_api = compute.AggregateAPI() self.servicegroup_api = servicegroup.API() diff --git a/nova/api/openstack/compute/shelve.py b/nova/api/openstack/compute/shelve.py index 3ae4d6c8bdfe..92efe3ebf780 100644 --- a/nova/api/openstack/compute/shelve.py +++ b/nova/api/openstack/compute/shelve.py @@ -27,8 +27,8 @@ from nova.policies import shelve as shelve_policies class ShelveController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(ShelveController, self).__init__(*args, **kwargs) + def __init__(self): + super(ShelveController, self).__init__() self.compute_api = compute.API() self.network_api = network.API() diff --git a/nova/api/openstack/compute/suspend_server.py b/nova/api/openstack/compute/suspend_server.py index 0993b5f909f4..dd576684b74e 100644 --- a/nova/api/openstack/compute/suspend_server.py +++ b/nova/api/openstack/compute/suspend_server.py @@ -22,8 +22,8 @@ from nova.policies import suspend_server as ss_policies class SuspendServerController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(SuspendServerController, self).__init__(*args, **kwargs) + def __init__(self): + super(SuspendServerController, self).__init__() self.compute_api = compute.API() @wsgi.response(202) diff --git a/nova/api/openstack/compute/tenant_networks.py b/nova/api/openstack/compute/tenant_networks.py index 2187dc64963b..b550c89ec134 100644 --- a/nova/api/openstack/compute/tenant_networks.py +++ b/nova/api/openstack/compute/tenant_networks.py @@ -52,6 +52,8 @@ def network_dict(network): class TenantNetworkController(wsgi.Controller): def __init__(self, network_api=None): + super(TenantNetworkController, self).__init__() + # TODO(stephenfin): 'network_api' is only being passed for use by tests self.network_api = nova.network.API() self._default_networks = [] diff --git a/nova/api/openstack/compute/volumes.py b/nova/api/openstack/compute/volumes.py index f7c5357e6d3b..c22e3e1db139 100644 --- a/nova/api/openstack/compute/volumes.py +++ b/nova/api/openstack/compute/volumes.py @@ -96,8 +96,8 @@ class VolumeController(wsgi.Controller): """The Volumes API controller for the OpenStack API.""" def __init__(self): - self.volume_api = cinder.API() super(VolumeController, self).__init__() + self.volume_api = cinder.API() @wsgi.Controller.api_version("2.1", MAX_PROXY_API_SUPPORT_VERSION) @wsgi.expected_errors(404) diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index b9a9b9c74125..3e8ff376d21e 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -756,11 +756,9 @@ class Controller(object): _view_builder_class = None - def __init__(self, view_builder=None): + def __init__(self): """Initialize controller with a view builder instance.""" - if view_builder: - self._view_builder = view_builder - elif self._view_builder_class: + if self._view_builder_class: self._view_builder = self._view_builder_class() else: self._view_builder = None