summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorSascha Peilicke <saschpe@suse.de>2012-06-25 17:33:25 +0200
committerSascha Peilicke <saschpe@suse.de>2012-06-26 10:46:42 +0200
commit2fa2cd2254a4044aaa584c4fcf5d6c3e1ec60d1f (patch)
tree0ffd107b0f7468ca0b3b2e5171629dd9f65693ee /nova
parentca1f1d39b8ee85f55d5b656f7db946f855be5cb2 (diff)
downloadnova-2fa2cd2254a4044aaa584c4fcf5d6c3e1ec60d1f.tar.gz
nova-2fa2cd2254a4044aaa584c4fcf5d6c3e1ec60d1f.tar.xz
nova-2fa2cd2254a4044aaa584c4fcf5d6c3e1ec60d1f.zip
Fix several PEP-8 issues
As found by pep8 version 1.2. Change-Id: I5d40294416db0410fa7d9c82ea8efe8efadd0f58
Diffstat (limited to 'nova')
-rw-r--r--nova/api/ec2/cloud.py2
-rw-r--r--nova/api/metadata/base.py4
-rw-r--r--nova/consoleauth/manager.py2
-rw-r--r--nova/db/sqlalchemy/api.py8
-rw-r--r--nova/network/l3.py2
-rw-r--r--nova/tests/api/openstack/compute/contrib/test_aggregates.py2
-rw-r--r--nova/tests/api/test_validator.py2
-rw-r--r--nova/tests/network/test_quantum.py2
-rw-r--r--nova/tests/test_imagecache.py2
-rw-r--r--nova/tests/test_metadata.py6
10 files changed, 16 insertions, 16 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 1bb505659..68f3b5b3d 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -334,7 +334,7 @@ class CloudController(object):
key_pairs = [x for x in key_pairs if x['name'] in key_name]
#If looking for non existent key pair
- if key_name != None and key_pairs == []:
+ if key_name is not None and not key_pairs:
msg = _('Could not find key pair(s): %s') % ','.join(key_name)
raise exception.EC2APIError(msg)
diff --git a/nova/api/metadata/base.py b/nova/api/metadata/base.py
index 379643954..3f7db817d 100644
--- a/nova/api/metadata/base.py
+++ b/nova/api/metadata/base.py
@@ -81,7 +81,7 @@ class InstanceMetadata():
self.mappings = _format_instance_mapping(ctxt, instance)
- if instance.get('user_data', None) != None:
+ if instance.get('user_data', None) is not None:
self.userdata_b64 = base64.b64decode(instance['user_data'])
else:
self.userdata_b64 = None
@@ -133,7 +133,7 @@ class InstanceMetadata():
for key in self.ec2_ids:
data['meta-data'][key] = self.ec2_ids[key]
- if self.userdata_b64 != None:
+ if self.userdata_b64 is not None:
data['user-data'] = self.userdata_b64
# public-keys should be in meta-data only if user specified one
diff --git a/nova/consoleauth/manager.py b/nova/consoleauth/manager.py
index 09f9a4046..049ce1fce 100644
--- a/nova/consoleauth/manager.py
+++ b/nova/consoleauth/manager.py
@@ -71,7 +71,7 @@ class ConsoleAuthManager(manager.Manager):
def check_token(self, context, token):
token_str = self.mc.get(token)
- token_valid = (token_str != None)
+ token_valid = (token_str is not None)
LOG.audit(_("Checking Token: %(token)s, %(token_valid)s)"), locals())
if token_valid:
return jsonutils.loads(token_str)
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index eabd03a22..34a30ebcd 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -611,13 +611,13 @@ def compute_node_utilization_set(context, host, free_ram_mb=None,
raise exception.NotFound(_("No ComputeNode for %(host)s") %
locals())
- if free_ram_mb != None:
+ if free_ram_mb is not None:
compute_node.free_ram_mb = free_ram_mb
- if free_disk_gb != None:
+ if free_disk_gb is not None:
compute_node.free_disk_gb = free_disk_gb
- if work != None:
+ if work is not None:
compute_node.current_workload = work
- if vms != None:
+ if vms is not None:
compute_node.running_vms = vms
return compute_node
diff --git a/nova/network/l3.py b/nova/network/l3.py
index bcd5d87c0..034678aa5 100644
--- a/nova/network/l3.py
+++ b/nova/network/l3.py
@@ -85,7 +85,7 @@ class LinuxNetL3(L3Driver):
self.initialized = True
def is_initialized(self):
- return self.initialized == True
+ return self.initialized
def initialize_network(self, cidr):
linux_net.add_snat_rule(cidr)
diff --git a/nova/tests/api/openstack/compute/contrib/test_aggregates.py b/nova/tests/api/openstack/compute/contrib/test_aggregates.py
index 080cf8428..fc19a9545 100644
--- a/nova/tests/api/openstack/compute/contrib/test_aggregates.py
+++ b/nova/tests/api/openstack/compute/contrib/test_aggregates.py
@@ -52,7 +52,7 @@ class AggregateTestCase(test.TestCase):
def test_index(self):
def stub_list_aggregates(context):
- if context == None:
+ if context is None:
raise Exception()
return AGGREGATE_LIST
self.stubs.Set(self.controller.api, 'get_aggregate_list',
diff --git a/nova/tests/api/test_validator.py b/nova/tests/api/test_validator.py
index 875cb6de4..132e67e95 100644
--- a/nova/tests/api/test_validator.py
+++ b/nova/tests/api/test_validator.py
@@ -26,7 +26,7 @@ class ValidatorTestCase(test.TestCase):
def test_validate(self):
fixture = {
- 'foo': lambda val: val == True
+ 'foo': lambda val: val is True
}
self.assertTrue(
diff --git a/nova/tests/network/test_quantum.py b/nova/tests/network/test_quantum.py
index 255444c7b..7f93c9c2b 100644
--- a/nova/tests/network/test_quantum.py
+++ b/nova/tests/network/test_quantum.py
@@ -492,7 +492,7 @@ class QuantumManagerTestCase(QuantumNovaTestCase):
net = db.network_get_by_uuid(ctx.elevated(), net_id)
self.assertTrue(net is not None)
self.assertEquals(net['uuid'], net_id)
- self.assertTrue(net['host'] != None)
+ self.assertTrue(net['host'] is not None)
class QuantumNovaMACGenerationTestCase(QuantumNovaTestCase):
diff --git a/nova/tests/test_imagecache.py b/nova/tests/test_imagecache.py
index 43ee7ed93..9ab10cc51 100644
--- a/nova/tests/test_imagecache.py
+++ b/nova/tests/test_imagecache.py
@@ -429,7 +429,7 @@ class ImageCacheManagerTestCase(test.TestCase):
image_cache_manager = imagecache.ImageCacheManager()
res = image_cache_manager._verify_checksum(
img, fname, create_if_missing=True)
- self.assertTrue(res == None)
+ self.assertTrue(res is None)
def test_verify_checksum_invalid(self):
img = {'container_format': 'ami', 'id': '42'}
diff --git a/nova/tests/test_metadata.py b/nova/tests/test_metadata.py
index c90e9c6c4..1d2cc37aa 100644
--- a/nova/tests/test_metadata.py
+++ b/nova/tests/test_metadata.py
@@ -66,7 +66,7 @@ def return_non_existing_address(*args, **kwarg):
def fake_InstanceMetadata(stubs, inst_data, address=None, sgroups=None):
- if sgroups == None:
+ if sgroups is None:
sgroups = [{'name': 'default'}]
def sg_get(*args, **kwargs):
@@ -84,7 +84,7 @@ def fake_request(stubs, mdinst, relpath, address="127.0.0.1",
app = handler.MetadataRequestHandler()
- if fake_get_metadata == None:
+ if fake_get_metadata is None:
fake_get_metadata = get_metadata
if stubs:
@@ -93,7 +93,7 @@ def fake_request(stubs, mdinst, relpath, address="127.0.0.1",
request = webob.Request.blank(relpath)
request.remote_addr = address
- if headers != None:
+ if headers is not None:
request.headers.update(headers)
response = request.get_response(app)