diff options
| author | Dirk Mueller <dirk@dmllr.de> | 2013-05-18 00:18:18 +0200 |
|---|---|---|
| committer | Dirk Mueller <dirk@dmllr.de> | 2013-06-01 09:57:31 +0200 |
| commit | bf68a9592db4c90bc9421ce49c7c0766966d6e7e (patch) | |
| tree | 0a02a49d60348af8cb74d9be59c7a961666b7f01 /nova/api | |
| parent | 5a510518d9e3097730466cfbf4ff25495c4a0302 (diff) | |
| download | nova-bf68a9592db4c90bc9421ce49c7c0766966d6e7e.tar.gz nova-bf68a9592db4c90bc9421ce49c7c0766966d6e7e.tar.xz nova-bf68a9592db4c90bc9421ce49c7c0766966d6e7e.zip | |
Improve Python 3.x compatibility
Mechanical translation of the deprecated
except x,y: construct with except x as y:
The latter works with any Python >= 2.6.
Add Hacking check.
Change-Id: I845829d97d379c1cd9b3a77e7e5786586f263b64
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/__init__.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/admin_actions.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/attach_interfaces.py | 4 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/flavor_access.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/flavormanage.py | 2 |
5 files changed, 6 insertions, 6 deletions
diff --git a/nova/api/ec2/__init__.py b/nova/api/ec2/__init__.py index dfe015456..12ea5f615 100644 --- a/nova/api/ec2/__init__.py +++ b/nova/api/ec2/__init__.py @@ -251,7 +251,7 @@ class EC2KeystoneAuth(wsgi.Middleware): project_name = result['access']['token']['tenant'].get('name') roles = [role['name'] for role in result['access']['user']['roles']] - except (AttributeError, KeyError), e: + except (AttributeError, KeyError) as e: LOG.exception(_("Keystone failure: %s") % e) msg = _("Failure communicating with keystone") return ec2_error(req, request_id, "Unauthorized", msg) diff --git a/nova/api/openstack/compute/contrib/admin_actions.py b/nova/api/openstack/compute/contrib/admin_actions.py index 3452136c0..10a318294 100644 --- a/nova/api/openstack/compute/contrib/admin_actions.py +++ b/nova/api/openstack/compute/contrib/admin_actions.py @@ -123,7 +123,7 @@ class AdminActionsController(wsgi.Controller): except exception.InstanceInvalidState as state_error: common.raise_http_conflict_for_instance_invalid_state(state_error, 'migrate') - except Exception, e: + except Exception as e: LOG.exception(_("Error in migrate %s"), e) raise exc.HTTPBadRequest() return webob.Response(status_int=202) diff --git a/nova/api/openstack/compute/contrib/attach_interfaces.py b/nova/api/openstack/compute/contrib/attach_interfaces.py index dfaa284fa..ec565a0d1 100644 --- a/nova/api/openstack/compute/contrib/attach_interfaces.py +++ b/nova/api/openstack/compute/contrib/attach_interfaces.py @@ -102,13 +102,13 @@ class InterfaceAttachmentController(object): LOG.audit(_("Attach interface"), instance=instance) network_info = self.compute_api.attach_interface(context, instance, network_id, port_id, req_ip) - except exception.NotFound, e: + except exception.NotFound as e: LOG.exception(e) raise exc.HTTPNotFound() except NotImplementedError: msg = _("Network driver does not support this function.") raise webob.exc.HTTPNotImplemented(explanation=msg) - except exception.InterfaceAttachFailed, e: + except exception.InterfaceAttachFailed as e: LOG.exception(e) msg = _("Failed to attach interface") raise webob.exc.HTTPInternalServerError(explanation=msg) diff --git a/nova/api/openstack/compute/contrib/flavor_access.py b/nova/api/openstack/compute/contrib/flavor_access.py index 566eb6472..47d7e07e2 100644 --- a/nova/api/openstack/compute/contrib/flavor_access.py +++ b/nova/api/openstack/compute/contrib/flavor_access.py @@ -191,7 +191,7 @@ class FlavorActionController(wsgi.Controller): try: flavors.remove_instance_type_access(id, tenant, context) - except exception.FlavorAccessNotFound, e: + except exception.FlavorAccessNotFound as e: raise webob.exc.HTTPNotFound(explanation=e.format_message()) return _marshall_flavor_access(id) diff --git a/nova/api/openstack/compute/contrib/flavormanage.py b/nova/api/openstack/compute/contrib/flavormanage.py index 086c541dc..8dc942f18 100644 --- a/nova/api/openstack/compute/contrib/flavormanage.py +++ b/nova/api/openstack/compute/contrib/flavormanage.py @@ -42,7 +42,7 @@ class FlavorManageController(wsgi.Controller): try: flavor = flavors.get_instance_type_by_flavor_id( id, read_deleted="no") - except exception.NotFound, e: + except exception.NotFound as e: raise webob.exc.HTTPNotFound(explanation=e.format_message()) flavors.destroy(flavor['name']) |
