From e9235184f338c98c40c20dee7d67e5d3a662e45a Mon Sep 17 00:00:00 2001 From: Jay Pipes Date: Sun, 8 Jul 2012 21:31:15 -0400 Subject: Make sure user dict has id key before checking against it The user dict passed to the update_user() method doesn't always have a key called 'id'. Make sure we check for the existence of the key before getting its value. Change-Id: I760fb6d99aa517a6877d8fb0124da78b0ec5f4b7 Fixes: LP #1022411 --- keystone/identity/backends/sql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keystone/identity/backends/sql.py b/keystone/identity/backends/sql.py index c324de80..b0ed154e 100644 --- a/keystone/identity/backends/sql.py +++ b/keystone/identity/backends/sql.py @@ -359,7 +359,7 @@ class Identity(sql.Base, identity.Driver): @handle_conflicts(type='user') def update_user(self, user_id, user): session = self.get_session() - if user_id != user['id']: + if 'id' in user and user_id != user['id']: raise exception.ValidationError('Cannot change user ID') with session.begin(): user_ref = session.query(User).filter_by(id=user_id).first() -- cgit