diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-01-31 15:36:49 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-01-31 15:36:49 +0000 |
| commit | 77dbed11a6bf95d56e563200d175fe3ada553a6f (patch) | |
| tree | d3d5ff65f5cfe96ee2f5f3189f8f4631a07cbb1d /nova/api | |
| parent | 98e37e905349c576f0550bec15d65d101c8bce3e (diff) | |
| parent | 8485129704f1611d13a16b7c43ab1bac46d66606 (diff) | |
| download | nova-77dbed11a6bf95d56e563200d175fe3ada553a6f.tar.gz nova-77dbed11a6bf95d56e563200d175fe3ada553a6f.tar.xz nova-77dbed11a6bf95d56e563200d175fe3ada553a6f.zip | |
Merge "Fixes 'not in' operator usage"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 8 | ||||
| -rw-r--r-- | nova/api/openstack/__init__.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/aggregates.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/availability_zone.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/flavorextraspecs.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/floating_ips_bulk.py | 4 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/simple_tenant_usage.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/image_metadata.py | 4 | ||||
| -rw-r--r-- | nova/api/openstack/compute/servers.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/wsgi.py | 2 |
10 files changed, 15 insertions, 15 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 05e6b8acd..b66b15852 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -280,7 +280,7 @@ class CloudController(object): host_services = {} for service in enabled_services: zone_hosts.setdefault(service['availability_zone'], []) - if not service['host'] in zone_hosts[service['availability_zone']]: + if service['host'] not in zone_hosts[service['availability_zone']]: zone_hosts[service['availability_zone']].append( service['host']) @@ -527,7 +527,7 @@ class CloudController(object): def _rule_args_to_dict(self, context, kwargs): rules = [] - if not 'groups' in kwargs and not 'ip_ranges' in kwargs: + if 'groups' not in kwargs and 'ip_ranges' not in kwargs: rule = self._rule_dict_last_step(context, **kwargs) if rule: rules.append(rule) @@ -1549,11 +1549,11 @@ class CloudController(object): if attribute != 'launchPermission': raise exception.EC2APIError(_('attribute not supported: %s') % attribute) - if not 'user_group' in kwargs: + if 'user_group' not in kwargs: raise exception.EC2APIError(_('user or group not specified')) if len(kwargs['user_group']) != 1 and kwargs['user_group'][0] != 'all': raise exception.EC2APIError(_('only group "all" is supported')) - if not operation_type in ['add', 'remove']: + if operation_type not in ['add', 'remove']: msg = _('operation_type must be add or remove') raise exception.EC2APIError(msg) LOG.audit(_("Updating image %s publicity"), image_id, context=context) diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py index d812cef18..a76b74324 100644 --- a/nova/api/openstack/__init__.py +++ b/nova/api/openstack/__init__.py @@ -102,7 +102,7 @@ class APIMapper(routes.Mapper): class ProjectMapper(APIMapper): def resource(self, member_name, collection_name, **kwargs): - if not ('parent_resource' in kwargs): + if 'parent_resource' not in kwargs: kwargs['path_prefix'] = '{project_id}/' else: parent_resource = kwargs['parent_resource'] diff --git a/nova/api/openstack/compute/contrib/aggregates.py b/nova/api/openstack/compute/contrib/aggregates.py index 91d138be4..84b0358a3 100644 --- a/nova/api/openstack/compute/contrib/aggregates.py +++ b/nova/api/openstack/compute/contrib/aggregates.py @@ -106,7 +106,7 @@ class AggregateController(object): raise exc.HTTPBadRequest for key in updates.keys(): - if not key in ["name", "availability_zone"]: + if key not in ["name", "availability_zone"]: raise exc.HTTPBadRequest try: diff --git a/nova/api/openstack/compute/contrib/availability_zone.py b/nova/api/openstack/compute/contrib/availability_zone.py index 6cde5ca64..98c508bd7 100644 --- a/nova/api/openstack/compute/contrib/availability_zone.py +++ b/nova/api/openstack/compute/contrib/availability_zone.py @@ -110,7 +110,7 @@ class AvailabilityZoneController(wsgi.Controller): host_services = {} for service in enabled_services: zone_hosts.setdefault(service['availability_zone'], []) - if not service['host'] in zone_hosts[service['availability_zone']]: + if service['host'] not in zone_hosts[service['availability_zone']]: zone_hosts[service['availability_zone']].append( service['host']) diff --git a/nova/api/openstack/compute/contrib/flavorextraspecs.py b/nova/api/openstack/compute/contrib/flavorextraspecs.py index 84f157b6a..12cc7d9ed 100644 --- a/nova/api/openstack/compute/contrib/flavorextraspecs.py +++ b/nova/api/openstack/compute/contrib/flavorextraspecs.py @@ -84,7 +84,7 @@ class FlavorExtraSpecsController(object): context = req.environ['nova.context'] authorize(context) self._check_body(body) - if not id in body: + if id not in body: expl = _('Request body and URI mismatch') raise exc.HTTPBadRequest(explanation=expl) if len(body) > 1: diff --git a/nova/api/openstack/compute/contrib/floating_ips_bulk.py b/nova/api/openstack/compute/contrib/floating_ips_bulk.py index f5b8d24dd..db506a15d 100644 --- a/nova/api/openstack/compute/contrib/floating_ips_bulk.py +++ b/nova/api/openstack/compute/contrib/floating_ips_bulk.py @@ -80,13 +80,13 @@ class FloatingIPBulkController(object): context = req.environ['nova.context'] authorize(context) - if not 'floating_ips_bulk_create' in body: + if 'floating_ips_bulk_create' not in body: raise webob.exc.HTTPUnprocessableEntity() params = body['floating_ips_bulk_create'] LOG.debug(params) - if not 'ip_range' in params: + if 'ip_range' not in params: raise webob.exc.HTTPUnprocessableEntity() ip_range = params['ip_range'] diff --git a/nova/api/openstack/compute/contrib/simple_tenant_usage.py b/nova/api/openstack/compute/contrib/simple_tenant_usage.py index 8502e93c4..2313c00ac 100644 --- a/nova/api/openstack/compute/contrib/simple_tenant_usage.py +++ b/nova/api/openstack/compute/contrib/simple_tenant_usage.py @@ -159,7 +159,7 @@ class SimpleTenantUsageController(object): info['uptime'] = delta.days * 24 * 3600 + delta.seconds - if not info['tenant_id'] in rval: + if info['tenant_id'] not in rval: summary = {} summary['tenant_id'] = info['tenant_id'] if detailed: diff --git a/nova/api/openstack/compute/image_metadata.py b/nova/api/openstack/compute/image_metadata.py index 1a467f3a7..7e78d6324 100644 --- a/nova/api/openstack/compute/image_metadata.py +++ b/nova/api/openstack/compute/image_metadata.py @@ -76,7 +76,7 @@ class Controller(object): expl = _('Incorrect request body format') raise exc.HTTPBadRequest(explanation=expl) - if not id in meta: + if id not in meta: expl = _('Request body and URI mismatch') raise exc.HTTPBadRequest(explanation=expl) if len(meta) > 1: @@ -105,7 +105,7 @@ class Controller(object): def delete(self, req, image_id, id): context = req.environ['nova.context'] image = self._get_image(context, image_id) - if not id in image['properties']: + if id not in image['properties']: msg = _("Invalid metadata key") raise exc.HTTPNotFound(explanation=msg) image['properties'].pop(id) diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 90d4c37b3..ac4ebd293 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -751,7 +751,7 @@ class Controller(wsgi.Controller): server_dict = body['server'] password = self._get_server_admin_password(server_dict) - if not 'name' in server_dict: + if 'name' not in server_dict: msg = _("Server name is not defined") raise exc.HTTPBadRequest(explanation=msg) diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index a6f255081..f68eff2a7 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -150,7 +150,7 @@ class Request(webob.Request): Does not do any body introspection, only checks header """ - if not "Content-Type" in self.headers: + if "Content-Type" not in self.headers: return None content_type = self.content_type |
