diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-03-01 21:57:48 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-03-01 21:57:48 +0000 |
| commit | 34d50ed65fc6f68fa5efb524ab4d82eea8e499f0 (patch) | |
| tree | 008de172ddc510b3f4cbbcf9a6fa83f5dd5015a0 /nova/api | |
| parent | 04d8721211614d4df2c3cf53db6ed89bd2f296a1 (diff) | |
| parent | 7dde170529574c9862e3f2149f8cd79cebce9a6c (diff) | |
| download | nova-34d50ed65fc6f68fa5efb524ab4d82eea8e499f0.tar.gz nova-34d50ed65fc6f68fa5efb524ab4d82eea8e499f0.tar.xz nova-34d50ed65fc6f68fa5efb524ab4d82eea8e499f0.zip | |
Merge "Remove unused imports and variables from OS API"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/auth.py | 3 | ||||
| -rw-r--r-- | nova/api/openstack/common.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/admin_actions.py | 14 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/consoles.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/floating_ip_dns.py | 1 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/floating_ips.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/multinic.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/security_groups.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/simple_tenant_usage.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/virtual_storage_arrays.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/images.py | 1 | ||||
| -rw-r--r-- | nova/api/openstack/compute/server_metadata.py | 8 | ||||
| -rw-r--r-- | nova/api/openstack/compute/servers.py | 4 | ||||
| -rw-r--r-- | nova/api/openstack/extensions.py | 5 | ||||
| -rw-r--r-- | nova/api/openstack/wsgi.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/xmlutil.py | 1 |
16 files changed, 20 insertions, 33 deletions
diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py index 18aaf8378..726e4ad28 100644 --- a/nova/api/openstack/auth.py +++ b/nova/api/openstack/auth.py @@ -22,7 +22,6 @@ import time import webob.dec import webob.exc -from nova.api.openstack import common from nova.api.openstack import wsgi from nova.auth import manager from nova import context @@ -159,7 +158,7 @@ class AuthMiddleware(base_wsgi.Middleware): """Ensures that the KeyError returned is meaningful.""" try: return req.headers[key] - except KeyError as ex: + except KeyError: raise KeyError(key) try: username = _get_auth_header('X-Auth-User') diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py index bc49a3948..d2a909409 100644 --- a/nova/api/openstack/common.py +++ b/nova/api/openstack/common.py @@ -27,10 +27,8 @@ from nova.api.openstack import wsgi from nova.api.openstack import xmlutil from nova.compute import vm_states from nova.compute import task_states -from nova import exception from nova import flags from nova import log as logging -from nova import network from nova.network import model as network_model from nova import quota diff --git a/nova/api/openstack/compute/contrib/admin_actions.py b/nova/api/openstack/compute/contrib/admin_actions.py index b1bfaf6ac..3339c4568 100644 --- a/nova/api/openstack/compute/contrib/admin_actions.py +++ b/nova/api/openstack/compute/contrib/admin_actions.py @@ -274,13 +274,13 @@ class AdminActionsController(wsgi.Controller): try: instance = self.compute_api.get(context, id) - result = scheduler_api.live_migration(context, - block_migration, - disk_over_commit, - instance["id"], - host, - topic=FLAGS.compute_topic) - except Exception, e: + scheduler_api.live_migration(context, + block_migration, + disk_over_commit, + instance["id"], + host, + topic=FLAGS.compute_topic) + except Exception: msg = _("Live migration of instance %(id)s to host %(host)s" " failed") % locals() LOG.exception(msg) diff --git a/nova/api/openstack/compute/contrib/consoles.py b/nova/api/openstack/compute/contrib/consoles.py index 833eb0f39..387d77b2c 100644 --- a/nova/api/openstack/compute/contrib/consoles.py +++ b/nova/api/openstack/compute/contrib/consoles.py @@ -54,7 +54,7 @@ class ConsolesController(wsgi.Controller): console_type) except exception.ConsoleTypeInvalid, e: raise webob.exc.HTTPBadRequest(_('Invalid type specification')) - except exception.NotAuthorized, e: + except exception.NotAuthorized: raise webob.exc.HTTPUnauthorized() except exception.NotFound: raise webob.exc.HTTPNotFound(_('Instance not found')) diff --git a/nova/api/openstack/compute/contrib/floating_ip_dns.py b/nova/api/openstack/compute/contrib/floating_ip_dns.py index 66d960b39..7c5c11042 100644 --- a/nova/api/openstack/compute/contrib/floating_ip_dns.py +++ b/nova/api/openstack/compute/contrib/floating_ip_dns.py @@ -189,7 +189,6 @@ class FloatingIPDNSDomainController(object): """Delete the domain identified by id. """ context = req.environ['nova.context'] authorize(context) - params = req.str_GET domain = _unquote_domain(id) # Delete the whole domain diff --git a/nova/api/openstack/compute/contrib/floating_ips.py b/nova/api/openstack/compute/contrib/floating_ips.py index ad74bc8a8..b026e6999 100644 --- a/nova/api/openstack/compute/contrib/floating_ips.py +++ b/nova/api/openstack/compute/contrib/floating_ips.py @@ -238,7 +238,7 @@ class FloatingIPActionController(wsgi.Controller): if floating_ip.get('fixed_ip_id'): try: self.network_api.disassociate_floating_ip(context, address) - except exception.NotAuthorized, e: + except exception.NotAuthorized: raise webob.exc.HTTPUnauthorized() return webob.Response(status_int=202) diff --git a/nova/api/openstack/compute/contrib/multinic.py b/nova/api/openstack/compute/contrib/multinic.py index 061a6d3b1..74f3d3bf2 100644 --- a/nova/api/openstack/compute/contrib/multinic.py +++ b/nova/api/openstack/compute/contrib/multinic.py @@ -73,7 +73,7 @@ class MultinicController(wsgi.Controller): try: self.compute_api.remove_fixed_ip(context, instance, address) - except exceptions.FixedIpNotFoundForSpecificInstance: + except exception.FixedIpNotFoundForSpecificInstance: LOG.exception(_("Unable to find address %r") % address) raise exc.HTTPBadRequest() diff --git a/nova/api/openstack/compute/contrib/security_groups.py b/nova/api/openstack/compute/contrib/security_groups.py index 89ef7dc78..9a4cdc7e8 100644 --- a/nova/api/openstack/compute/contrib/security_groups.py +++ b/nova/api/openstack/compute/contrib/security_groups.py @@ -495,7 +495,7 @@ class SecurityGroupRulesController(SecurityGroupControllerBase): except ValueError: msg = _("Rule id is not integer") raise exc.HTTPBadRequest(explanation=msg) - except exception.NotFound as exp: + except exception.NotFound: msg = _("Rule (%s) not found") % id raise exc.HTTPNotFound(explanation=msg) diff --git a/nova/api/openstack/compute/contrib/simple_tenant_usage.py b/nova/api/openstack/compute/contrib/simple_tenant_usage.py index fd1a95949..99296aebe 100644 --- a/nova/api/openstack/compute/contrib/simple_tenant_usage.py +++ b/nova/api/openstack/compute/contrib/simple_tenant_usage.py @@ -18,8 +18,6 @@ from datetime import datetime import urlparse -import webob - from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova.api.openstack import xmlutil diff --git a/nova/api/openstack/compute/contrib/virtual_storage_arrays.py b/nova/api/openstack/compute/contrib/virtual_storage_arrays.py index ff275f911..7581fc82a 100644 --- a/nova/api/openstack/compute/contrib/virtual_storage_arrays.py +++ b/nova/api/openstack/compute/contrib/virtual_storage_arrays.py @@ -214,6 +214,8 @@ class VsaController(object): context = req.environ['nova.context'] authorize(context) + # FIXME(comstud): Seems like this always assigns 'auto' right + # now despite what the docstring says this should support. if body is None: ip = 'auto' else: diff --git a/nova/api/openstack/compute/images.py b/nova/api/openstack/compute/images.py index 296aacb4b..1a957bc56 100644 --- a/nova/api/openstack/compute/images.py +++ b/nova/api/openstack/compute/images.py @@ -19,7 +19,6 @@ from nova.api.openstack import common from nova.api.openstack.compute.views import images as views_images from nova.api.openstack import wsgi from nova.api.openstack import xmlutil -from nova import compute from nova import exception from nova import flags import nova.image diff --git a/nova/api/openstack/compute/server_metadata.py b/nova/api/openstack/compute/server_metadata.py index cd7ebb545..f70158ec3 100644 --- a/nova/api/openstack/compute/server_metadata.py +++ b/nova/api/openstack/compute/server_metadata.py @@ -76,9 +76,7 @@ class Controller(object): expl = _('Malformed request body') raise exc.HTTPBadRequest(explanation=expl) - try: - meta_value = meta_item[id] - except (AttributeError, KeyError): + if id not in meta_item: expl = _('Request body and URI mismatch') raise exc.HTTPBadRequest(explanation=expl) @@ -150,9 +148,7 @@ class Controller(object): metadata = self._get_metadata(context, server_id) - try: - meta_value = metadata[id] - except KeyError: + if id not in metadata: msg = _("Metadata item was not found") raise exc.HTTPNotFound(explanation=msg) diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 5660d28f5..b27f1802c 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -968,7 +968,7 @@ class Controller(wsgi.Controller): """Ensure that we can work with the metadata given.""" try: metadata.iteritems() - except AttributeError as ex: + except AttributeError: msg = _("Unable to parse metadata key/value pairs.") LOG.debug(msg) raise exc.HTTPBadRequest(explanation=msg) @@ -1060,7 +1060,7 @@ class Controller(wsgi.Controller): except exception.InstanceNotFound: msg = _("Instance could not be found") raise exc.HTTPNotFound(explanation=msg) - except exception.ImageNotFound as error: + except exception.ImageNotFound: msg = _("Cannot find image for rebuild") raise exc.HTTPBadRequest(explanation=msg) diff --git a/nova/api/openstack/extensions.py b/nova/api/openstack/extensions.py index 8d04b017f..7d4a167dd 100644 --- a/nova/api/openstack/extensions.py +++ b/nova/api/openstack/extensions.py @@ -16,9 +16,7 @@ # License for the specific language governing permissions and limitations # under the License. -import functools import os -import routes import webob.dec import webob.exc @@ -31,7 +29,6 @@ from nova import flags from nova import log as logging import nova.policy from nova import utils -from nova import wsgi as base_wsgi LOG = logging.getLogger(__name__) @@ -304,7 +301,7 @@ def wrap_errors(fn): def wrapped(*args, **kwargs): try: return fn(*args, **kwargs) - except Exception, e: + except Exception: raise webob.exc.HTTPInternalServerError() return wrapped diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index 78f4914ed..9be0501fd 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -898,7 +898,7 @@ class Resource(wsgi.Application): meth = getattr(self, action) else: meth = getattr(self.controller, action) - except AttributeError as ex: + except AttributeError: if (not self.wsgi_actions or action not in ['action', 'create', 'delete']): # Propagate the error diff --git a/nova/api/openstack/xmlutil.py b/nova/api/openstack/xmlutil.py index 2485ef2c5..e5f83a3e5 100644 --- a/nova/api/openstack/xmlutil.py +++ b/nova/api/openstack/xmlutil.py @@ -19,7 +19,6 @@ import os.path from lxml import etree -from nova.api.openstack import wsgi from nova import utils |
