"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/identity/backends/sql.py" between
keystone-16.0.1.tar.gz and keystone-16.0.2.tar.gz

About: OpenStack Keystone (Core Service: Identity) provides an authentication and authorization service for other OpenStack services. Provides a catalog of endpoints for all OpenStack services.
The "Train" series (maintained release).

sql.py  (keystone-16.0.1):sql.py  (keystone-16.0.2)
skipping to change at line 33 skipping to change at line 33
from keystone.common import sql from keystone.common import sql
import keystone.conf import keystone.conf
from keystone import exception from keystone import exception
from keystone.i18n import _ from keystone.i18n import _
from keystone.identity.backends import base from keystone.identity.backends import base
from keystone.identity.backends import resource_options as options from keystone.identity.backends import resource_options as options
from keystone.identity.backends import sql_model as model from keystone.identity.backends import sql_model as model
CONF = keystone.conf.CONF CONF = keystone.conf.CONF
def _stale_data_exception_checker(exc):
return isinstance(exc, sqlalchemy.orm.exc.StaleDataError)
class Identity(base.IdentityDriverBase): class Identity(base.IdentityDriverBase):
# NOTE(henry-nash): Override the __init__() method so as to take a # NOTE(henry-nash): Override the __init__() method so as to take a
# config parameter to enable sql to be used as a domain-specific driver. # config parameter to enable sql to be used as a domain-specific driver.
def __init__(self, conf=None): def __init__(self, conf=None):
self.conf = conf self.conf = conf
super(Identity, self).__init__() super(Identity, self).__init__()
@property @property
def is_sql(self): def is_sql(self):
return True return True
skipping to change at line 202 skipping to change at line 205
query = query.filter(sqlalchemy.and_( query = query.filter(sqlalchemy.and_(
model.LocalUser.name == user_name, model.LocalUser.name == user_name,
model.LocalUser.domain_id == domain_id)) model.LocalUser.domain_id == domain_id))
try: try:
user_ref = query.one() user_ref = query.one()
except sql.NotFound: except sql.NotFound:
raise exception.UserNotFound(user_id=user_name) raise exception.UserNotFound(user_id=user_name)
return base.filter_user(user_ref.to_dict()) return base.filter_user(user_ref.to_dict())
@sql.handle_conflicts(conflict_type='user') @sql.handle_conflicts(conflict_type='user')
# Explicitly retry on StaleDataErrors, which can happen if two clients
# update the same user's password and the second client has stale password
# information.
@oslo_db_api.wrap_db_retry(exception_checker=_stale_data_exception_checker)
def update_user(self, user_id, user): def update_user(self, user_id, user):
with sql.session_for_write() as session: with sql.session_for_write() as session:
user_ref = self._get_user(session, user_id) user_ref = self._get_user(session, user_id)
old_user_dict = user_ref.to_dict() old_user_dict = user_ref.to_dict()
for k in user: for k in user:
old_user_dict[k] = user[k] old_user_dict[k] = user[k]
new_user = model.User.from_dict(old_user_dict) new_user = model.User.from_dict(old_user_dict)
for attr in model.User.attributes: for attr in model.User.attributes:
if attr not in model.User.readonly_attributes: if attr not in model.User.readonly_attributes:
setattr(user_ref, attr, getattr(new_user, attr)) setattr(user_ref, attr, getattr(new_user, attr))
 End of changes. 2 change blocks. 
0 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)