From 973b2d6892dfacb3d9a2f7e87514f6e18faa37e4 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Wed, 17 Nov 2010 13:56:42 -0600 Subject: Improved Pylint Score --- nova/db/sqlalchemy/api.py | 9 ++++----- nova/image/services/glance/__init__.py | 1 + nova/network/linux_net.py | 2 +- nova/objectstore/bucket.py | 4 ++-- nova/objectstore/image.py | 4 ++-- nova/virt/libvirt_conn.py | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index b8f999af4..2a5442d9b 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -44,7 +44,6 @@ def is_admin_context(context): warnings.warn('Use of empty request context is deprecated', DeprecationWarning) raise Exception('die') - return True return context.is_admin @@ -502,14 +501,14 @@ def fixed_ip_get_by_address(context, address, session=None): @require_context def fixed_ip_get_instance(context, address): - fixed_ip_ref = fixed_ip_get_by_address(context, address) - return fixed_ip_ref.instance + fixed_ip_ref = fixed_ip_get_by_address(context, address) + return fixed_ip_ref.instance @require_admin_context def fixed_ip_get_network(context, address): - fixed_ip_ref = fixed_ip_get_by_address(context, address) - return fixed_ip_ref.network + fixed_ip_ref = fixed_ip_get_by_address(context, address) + return fixed_ip_ref.network @require_context diff --git a/nova/image/services/glance/__init__.py b/nova/image/services/glance/__init__.py index f1d05f0bc..9617ab7a3 100644 --- a/nova/image/services/glance/__init__.py +++ b/nova/image/services/glance/__init__.py @@ -19,6 +19,7 @@ import httplib import json +import logging import urlparse import webob.exc diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index 7b323efa1..4ea24cda6 100644 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -244,7 +244,7 @@ def _confirm_rule(chain, cmd): def _remove_rule(chain, cmd): """Remove iptables rule""" if FLAGS.use_nova_chains: - chain = "%S" % chain.lower() + chain = "%s" % chain.lower() _execute("sudo iptables --delete %s %s" % (chain, cmd)) diff --git a/nova/objectstore/bucket.py b/nova/objectstore/bucket.py index 0ba4934d1..697982538 100644 --- a/nova/objectstore/bucket.py +++ b/nova/objectstore/bucket.py @@ -78,8 +78,8 @@ class Bucket(object): path = os.path.abspath(os.path.join( FLAGS.buckets_path, bucket_name)) if not path.startswith(os.path.abspath(FLAGS.buckets_path)) or \ - os.path.exists(path): - raise exception.NotAuthorized() + os.path.exists(path): + raise exception.NotAuthorized() os.makedirs(path) diff --git a/nova/objectstore/image.py b/nova/objectstore/image.py index b7b2ec6ab..4554444fa 100644 --- a/nova/objectstore/image.py +++ b/nova/objectstore/image.py @@ -48,8 +48,8 @@ class Image(object): self.image_id = image_id self.path = os.path.abspath(os.path.join(FLAGS.images_path, image_id)) if not self.path.startswith(os.path.abspath(FLAGS.images_path)) or \ - not os.path.isdir(self.path): - raise exception.NotFound + not os.path.isdir(self.path): + raise exception.NotFound @property def image_path(self): diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py index 535a3b53e..18085089f 100644 --- a/nova/virt/libvirt_conn.py +++ b/nova/virt/libvirt_conn.py @@ -420,7 +420,7 @@ class LibvirtConnection(object): @defer.inlineCallbacks def _create_image(self, inst, libvirt_xml, prefix='', disk_images=None): # syntactic nicety - basepath = lambda fname='', prefix=prefix: os.path.join( + basepath = lambda fname = '', prefix = prefix: os.path.join( FLAGS.instances_path, inst['name'], prefix + fname) @@ -457,7 +457,7 @@ class LibvirtConnection(object): yield images.fetch(inst.ramdisk_id, basepath('ramdisk'), user, project) - execute = lambda cmd, process_input=None, check_exit_code=True: \ + execute = lambda cmd, process_input = None, check_exit_code = True: \ process.simple_execute(cmd=cmd, process_input=process_input, check_exit_code=check_exit_code) -- cgit