summaryrefslogtreecommitdiffstats
path: root/ipaserver/plugins/ldap2.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2011-03-30 10:20:40 -0400
committerRob Crittenden <rcritten@redhat.com>2011-03-31 13:08:32 -0400
commite1ef08083740df3fc24e09505bd52630ba05c573 (patch)
tree5fc0b022264b5cbed8ee8d1b953c811abce91762 /ipaserver/plugins/ldap2.py
parent463d7d2fe8553e51b51361cc607487c5750a350d (diff)
downloadfreeipa.git-e1ef08083740df3fc24e09505bd52630ba05c573.tar.gz
freeipa.git-e1ef08083740df3fc24e09505bd52630ba05c573.tar.xz
freeipa.git-e1ef08083740df3fc24e09505bd52630ba05c573.zip
Cache the value of get_ipa_config() in the request context.
There are some operations that fetch the configuration multiple times. This will return a cached value instead of getting it from LDAP over and over. ticket 1023
Diffstat (limited to 'ipaserver/plugins/ldap2.py')
-rw-r--r--ipaserver/plugins/ldap2.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py
index 13950d9a..a120efeb 100644
--- a/ipaserver/plugins/ldap2.py
+++ b/ipaserver/plugins/ldap2.py
@@ -633,6 +633,12 @@ class ldap2(CrudBackend, Encoder):
"""Returns the IPA configuration entry (dn, entry_attrs)."""
cdn = "%s,%s" % (api.Object.config.get_dn(), api.env.basedn)
try:
+ config_entry = getattr(context, 'config_entry')
+ return (cdn, config_entry)
+ except AttributeError:
+ # Not in our context yet
+ pass
+ try:
(cdn, config_entry) = self.find_entries(
None, attrs_list, base_dn=cdn, scope=self.SCOPE_BASE,
time_limit=2, size_limit=10
@@ -642,6 +648,7 @@ class ldap2(CrudBackend, Encoder):
for a in self.config_defaults:
if a not in config_entry:
config_entry[a] = self.config_defaults[a]
+ setattr(context, 'config_entry', config_entry)
return (cdn, config_entry)
def get_schema(self):