Code question on domain config reloads

asked 2015-03-30 15:25:23 -0500

pentatonic gravatar image

I have been looking at the latest code from master (Kilo 2 be), to understand how the domain configs are being loaded from the database, with the new APIs in identity 3.4: http://specs.openstack.org/openstack/keystone-specs/api/v3/identity-api-v3.html#domain-configuration-management (http://specs.openstack.org/openstack/...) )

I see where, in keystone/keystone/identity/core.py, the domain_configured wrapper makes sure that domain configs and drivers have been loaded.

But how does the system know to re-load modified configs:

def domains_configured(f):
"""Wraps API calls to lazy load domain configs after init.

This is required since the assignment manager needs to be initialized
before this manager, and yet this manager's init wants to be
able to make assignment calls (to build the domain configs).  So
instead, we check if the domains have been initialized on entry
to each call, and if requires load them,

"""
@functools.wraps(f)
def wrapper(self, *args, **kwargs):
    if (not self.domain_configs.configured and
            CONF.identity.domain_specific_drivers_enabled):
        self.domain_configs.setup_domain_drivers(
            self.driver, self.resource_api)
    return f(self, *args, **kwargs)
return wrapper

In particular, the line " if (not self.domain_configs.configured ". The configured flag is set to True and remains that way. So I'm not understanding how configs get reloaded when say someone changes an option for that config.

I saw that resource/core.py uses MEMOIZE and I'm sure there is some cache invalidation that happens (get_config_with_sensitive_info calls invalidate), but I'm having trouble finding the exact piece of code that would illustrate how the new config gets accounted for since the wrapper above seems like it will not reload anything because of the configure flag being set to True already.

edit retag flag offensive close merge delete