summaryrefslogtreecommitdiffstats
path: root/keystone
diff options
context:
space:
mode:
authorChmouel Boudjnah <chmouel@chmouel.com>2012-05-24 16:14:35 +0200
committerChmouel Boudjnah <chmouel@chmouel.com>2012-05-24 16:21:09 +0200
commitbb2fbb703092b8c788ae4da718f32fcf86f1f9eb (patch)
tree9a261a6300f8b6dfb3c0c2476bcdd9d622789a53 /keystone
parent33d107aa1d3e1aa2c188f9df7338a1e7d97a4ed2 (diff)
Fixes some pep8 warning/errors.
- Using flake8 so a bit more than that. Change-Id: I63fa21f7d3d02f96c0c56804fdd56da37c952d7d
Diffstat (limited to 'keystone')
-rw-r--r--keystone/catalog/backends/sql.py3
-rw-r--r--keystone/catalog/core.py2
-rw-r--r--keystone/common/manager.py1
-rw-r--r--keystone/common/sql/core.py1
-rw-r--r--keystone/common/sql/migration.py1
-rw-r--r--keystone/common/utils.py1
-rw-r--r--keystone/contrib/ec2/backends/kvs.py3
-rw-r--r--keystone/contrib/ec2/backends/sql.py1
-rw-r--r--keystone/identity/backends/ldap/core.py2
-rw-r--r--keystone/identity/core.py3
-rw-r--r--keystone/middleware/auth_token.py2
-rw-r--r--keystone/openstack/common/setup.py1
-rw-r--r--keystone/test.py2
13 files changed, 8 insertions, 15 deletions
diff --git a/keystone/catalog/backends/sql.py b/keystone/catalog/backends/sql.py
index 3c553e0c..3f9a6abf 100644
--- a/keystone/catalog/backends/sql.py
+++ b/keystone/catalog/backends/sql.py
@@ -15,9 +15,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import sqlalchemy.exc
-import webob.exc
-
from keystone import catalog
from keystone import config
from keystone import exception
diff --git a/keystone/catalog/core.py b/keystone/catalog/core.py
index 98b5ae9d..68bcae24 100644
--- a/keystone/catalog/core.py
+++ b/keystone/catalog/core.py
@@ -178,4 +178,4 @@ class EndpointController(wsgi.Application):
def delete_endpoint(self, context, endpoint_id):
self.assert_admin(context)
- endpoint_ref = self.catalog_api.delete_endpoint(context, endpoint_id)
+ self.catalog_api.delete_endpoint(context, endpoint_id)
diff --git a/keystone/common/manager.py b/keystone/common/manager.py
index 06c2ec67..18f3c41f 100644
--- a/keystone/common/manager.py
+++ b/keystone/common/manager.py
@@ -16,7 +16,6 @@
import functools
-from keystone import config
from keystone.common import utils
diff --git a/keystone/common/sql/core.py b/keystone/common/sql/core.py
index 5193e0c4..618994b0 100644
--- a/keystone/common/sql/core.py
+++ b/keystone/common/sql/core.py
@@ -19,7 +19,6 @@
import json
-import eventlet.db_pool
import sqlalchemy as sql
from sqlalchemy import types as sql_types
from sqlalchemy.exc import DisconnectionError
diff --git a/keystone/common/sql/migration.py b/keystone/common/sql/migration.py
index 616b9c91..e2b4f5ec 100644
--- a/keystone/common/sql/migration.py
+++ b/keystone/common/sql/migration.py
@@ -20,7 +20,6 @@
import os
import sys
-import sqlalchemy
from migrate.versioning import api as versioning_api
from keystone import config
diff --git a/keystone/common/utils.py b/keystone/common/utils.py
index 09ef565a..adff875a 100644
--- a/keystone/common/utils.py
+++ b/keystone/common/utils.py
@@ -198,7 +198,6 @@ def ldap_check_password(password, hashed):
if password is None:
return False
password_utf8 = trunc_password(password).encode('utf-8')
- h = passlib.hash.ldap_salted_sha1.encrypt(password_utf8)
return passlib.hash.ldap_salted_sha1.verify(password_utf8, hashed)
diff --git a/keystone/contrib/ec2/backends/kvs.py b/keystone/contrib/ec2/backends/kvs.py
index 3e967ca7..549c308e 100644
--- a/keystone/contrib/ec2/backends/kvs.py
+++ b/keystone/contrib/ec2/backends/kvs.py
@@ -37,7 +37,8 @@ class Ec2(kvs.Base):
return credential
def delete_credential(self, credential_id):
- old_credential = self.db.get('credential-%s' % credential_id)
+ # This will ensure credential-%s is here before deleting
+ self.db.get('credential-%s' % credential_id)
self.db.delete('credential-%s' % credential_id)
credential_list = set(self.db.get('credential_list', []))
credential_list.remove(credential_id)
diff --git a/keystone/contrib/ec2/backends/sql.py b/keystone/contrib/ec2/backends/sql.py
index d84c381c..c3af4648 100644
--- a/keystone/contrib/ec2/backends/sql.py
+++ b/keystone/contrib/ec2/backends/sql.py
@@ -15,7 +15,6 @@
# under the License.
from keystone.common import sql
-from keystone.common.sql import migration
class Ec2Credential(sql.ModelBase, sql.DictBase):
diff --git a/keystone/identity/backends/ldap/core.py b/keystone/identity/backends/ldap/core.py
index 7dc3bbbb..2a2c572e 100644
--- a/keystone/identity/backends/ldap/core.py
+++ b/keystone/identity/backends/ldap/core.py
@@ -100,7 +100,7 @@ class Identity(identity.Driver):
else:
metadata_ref = {}
- return (_filter_user(user_ref), tenant_ref, metadata_ref)
+ return (_filter_user(user_ref), tenant_ref, metadata_ref)
def get_tenant(self, tenant_id):
return self.tenant.get(tenant_id)
diff --git a/keystone/identity/core.py b/keystone/identity/core.py
index 6421ea26..2857f66b 100644
--- a/keystone/identity/core.py
+++ b/keystone/identity/core.py
@@ -581,7 +581,8 @@ class RoleController(wsgi.Application):
"""
self.assert_admin(context)
- user_ref = self.identity_api.get_user(context, user_id)
+ # Ensure user exists by getting it first.
+ self.identity_api.get_user(context, user_id)
tenant_ids = self.identity_api.get_tenants_for_user(context, user_id)
o = []
for tenant_id in tenant_ids:
diff --git a/keystone/middleware/auth_token.py b/keystone/middleware/auth_token.py
index 92c889d5..869c147d 100644
--- a/keystone/middleware/auth_token.py
+++ b/keystone/middleware/auth_token.py
@@ -444,7 +444,7 @@ class AuthProtocol(object):
:return wsgi env variable name (ex. 'HTTP_X_AUTH_TOKEN')
"""
- return 'HTTP_%s' % key.replace('-', '_').upper()
+ return 'HTTP_%s' % key.replace('-', '_').upper()
def _add_headers(self, env, headers):
"""Add http headers to environment."""
diff --git a/keystone/openstack/common/setup.py b/keystone/openstack/common/setup.py
index 2c16b5b3..984cce1f 100644
--- a/keystone/openstack/common/setup.py
+++ b/keystone/openstack/common/setup.py
@@ -48,7 +48,6 @@ def canonicalize_emails(changelog, mapping):
# Get requirements from the first file that exists
def get_reqs_from_files(requirements_files):
- reqs_in = []
for requirements_file in requirements_files:
if os.path.exists(requirements_file):
return open(requirements_file, 'r').read().split('\n')
diff --git a/keystone/test.py b/keystone/test.py
index 1e733ed2..5b7d66e4 100644
--- a/keystone/test.py
+++ b/keystone/test.py
@@ -80,7 +80,7 @@ def checkout_vendor(repo, rev):
# write out a modified time
with open(modcheck, 'w') as fd:
fd.write('1')
- except subprocess.CalledProcessError as e:
+ except subprocess.CalledProcessError:
LOG.warning('Failed to checkout %s', repo)
cd(working_dir)
return revdir