diff options
author | Stanislaw Pitucha <stanislaw.pitucha@hp.com> | 2013-06-13 13:57:15 +0000 |
---|---|---|
committer | Stanislaw Pitucha <stanislaw.pitucha@hp.com> | 2013-06-13 17:04:08 +0000 |
commit | 9f7eaca80d259201844f097fec24d1e9fe9fb5e3 (patch) | |
tree | 2e2c40b54a0d7c1b7e73818c281ad375d0a99861 /nova/api | |
parent | 77595f8e08a61507ad5c7c990651fd4f8131c150 (diff) | |
download | nova-9f7eaca80d259201844f097fec24d1e9fe9fb5e3.tar.gz nova-9f7eaca80d259201844f097fec24d1e9fe9fb5e3.tar.xz nova-9f7eaca80d259201844f097fec24d1e9fe9fb5e3.zip |
Remove trivial cases of unused variables (1)
Kill some of the variables marked as unused by flakes8. This should
allow to enable F841 check in the future.
Only trivial cases with no function calls and obviously pure functions
(like datetime.now(), or len()) are cleaned up here.
Part 1, split to reduce conflicts.
Change-Id: I82854349574ec4bcb9336aba626eefdaed81a8c8
Diffstat (limited to 'nova/api')
-rw-r--r-- | nova/api/ec2/cloud.py | 4 | ||||
-rw-r--r-- | nova/api/metadata/password.py | 1 | ||||
-rw-r--r-- | nova/api/openstack/compute/contrib/attach_interfaces.py | 2 | ||||
-rw-r--r-- | nova/api/openstack/compute/contrib/extended_ips.py | 2 | ||||
-rw-r--r-- | nova/api/openstack/compute/contrib/fixed_ips.py | 3 | ||||
-rw-r--r-- | nova/api/openstack/compute/contrib/flavorextraspecs.py | 2 | ||||
-rw-r--r-- | nova/api/openstack/compute/contrib/services.py | 3 | ||||
-rw-r--r-- | nova/api/openstack/compute/servers.py | 8 |
8 files changed, 10 insertions, 15 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 47575b201..e02f7b6f9 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -802,7 +802,6 @@ class CloudController(object): 'detaching': 'in-use'} instance_ec2_id = None - instance_data = None if volume.get('instance_uuid', None): instance_uuid = volume['instance_uuid'] @@ -810,8 +809,7 @@ class CloudController(object): instance_uuid) instance_ec2_id = ec2utils.id_to_ec2_inst_id(instance_uuid) - instance_data = '%s[%s]' % (instance_ec2_id, - instance['host']) + v = {} v['volumeId'] = ec2utils.id_to_ec2_vol_id(volume['id']) v['status'] = valid_ec2_api_volume_status_map.get(volume['status'], diff --git a/nova/api/metadata/password.py b/nova/api/metadata/password.py index f3453e945..50f6c94ac 100644 --- a/nova/api/metadata/password.py +++ b/nova/api/metadata/password.py @@ -49,7 +49,6 @@ def convert_password(context, password): def handle_password(req, meta_data): ctxt = context.get_admin_context() - password = meta_data.password if req.method == 'GET': return meta_data.password elif req.method == 'POST': diff --git a/nova/api/openstack/compute/contrib/attach_interfaces.py b/nova/api/openstack/compute/contrib/attach_interfaces.py index ec565a0d1..a823eed2b 100644 --- a/nova/api/openstack/compute/contrib/attach_interfaces.py +++ b/nova/api/openstack/compute/contrib/attach_interfaces.py @@ -60,7 +60,7 @@ class InterfaceAttachmentController(object): port_id = id try: - instance = self.compute_api.get(context, server_id) + self.compute_api.get(context, server_id) except exception.NotFound: raise exc.HTTPNotFound() diff --git a/nova/api/openstack/compute/contrib/extended_ips.py b/nova/api/openstack/compute/contrib/extended_ips.py index ac75293a6..20356c08d 100644 --- a/nova/api/openstack/compute/contrib/extended_ips.py +++ b/nova/api/openstack/compute/contrib/extended_ips.py @@ -94,7 +94,7 @@ def make_server(elem): class ExtendedIpsServerTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server', selector='server') - elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') + xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(root) return xmlutil.SlaveTemplate(root, 1, nsmap={ Extended_ips.alias: Extended_ips.namespace}) diff --git a/nova/api/openstack/compute/contrib/fixed_ips.py b/nova/api/openstack/compute/contrib/fixed_ips.py index b474b685d..532282a2b 100644 --- a/nova/api/openstack/compute/contrib/fixed_ips.py +++ b/nova/api/openstack/compute/contrib/fixed_ips.py @@ -69,8 +69,7 @@ class FixedIPController(object): fixed_ip = db.fixed_ip_get_by_address(context, address) db.fixed_ip_update(context, fixed_ip['address'], {'reserved': reserved}) - except (exception.FixedIpNotFoundForAddress, - exception.FixedIpInvalid) as ex: + except (exception.FixedIpNotFoundForAddress, exception.FixedIpInvalid): msg = _("Fixed IP %s not found") % address raise webob.exc.HTTPNotFound(explanation=msg) diff --git a/nova/api/openstack/compute/contrib/flavorextraspecs.py b/nova/api/openstack/compute/contrib/flavorextraspecs.py index 6e33d3603..00e7d7233 100644 --- a/nova/api/openstack/compute/contrib/flavorextraspecs.py +++ b/nova/api/openstack/compute/contrib/flavorextraspecs.py @@ -104,7 +104,7 @@ class FlavorExtraSpecsController(object): extra_spec = db.instance_type_extra_specs_get_item(context, flavor_id, id) return extra_spec - except exception.InstanceTypeExtraSpecsNotFound as e: + except exception.InstanceTypeExtraSpecsNotFound: raise exc.HTTPNotFound() def delete(self, req, flavor_id, id): diff --git a/nova/api/openstack/compute/contrib/services.py b/nova/api/openstack/compute/contrib/services.py index 3a637010a..76eec7ce4 100644 --- a/nova/api/openstack/compute/contrib/services.py +++ b/nova/api/openstack/compute/contrib/services.py @@ -183,8 +183,7 @@ class ServiceController(object): raise webob.exc.HTTPUnprocessableEntity(detail=msg) try: - svc = self.host_api.service_update(context, host, binary, - status_detail) + self.host_api.service_update(context, host, binary, status_detail) except exception.ServiceNotFound: raise webob.exc.HTTPNotFound(_("Unknown service")) diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 67d64127a..b65aa3f48 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -552,10 +552,10 @@ class Controller(wsgi.Controller): search_opts=search_opts, limit=limit, marker=marker) - except exception.MarkerNotFound as e: + except exception.MarkerNotFound: msg = _('marker [%s] not found') % marker raise exc.HTTPBadRequest(explanation=msg) - except exception.FlavorNotFound as e: + except exception.FlavorNotFound: log_msg = _("Flavor '%s' could not be found ") LOG.debug(log_msg, search_opts['flavor']) instance_list = [] @@ -1094,11 +1094,11 @@ class Controller(wsgi.Controller): except exception.InstanceInvalidState as state_error: common.raise_http_conflict_for_instance_invalid_state(state_error, 'resize') - except exception.ImageNotAuthorized as image_error: + except exception.ImageNotAuthorized: msg = _("You are not authorized to access the image " "the instance was started with.") raise exc.HTTPUnauthorized(explanation=msg) - except exception.ImageNotFound as image_error: + except exception.ImageNotFound: msg = _("Image that the instance was started " "with could not be found.") raise exc.HTTPBadRequest(explanation=msg) |