mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-03-26 21:33:05 +00:00
IPAAnsibleModule: cache IPA domain.
Some attributes retrieved by the IPA API backend don't change, and are used more than once, in different places of the code. IPA API domain is one of these attributes. This patch adds a cache to the attribute, so there is only one request for the API, improving access time to the object and alowing multiple calls with no efficiency penalty.
This commit is contained in:
@@ -875,10 +875,11 @@ else:
|
||||
"""
|
||||
return api_command_no_name(self, command, args)
|
||||
|
||||
@staticmethod
|
||||
def ipa_get_domain():
|
||||
def ipa_get_domain(self):
|
||||
"""Retrieve IPA API domain."""
|
||||
return api_get_domain()
|
||||
if not hasattr(self, "__ipa_api_domain"):
|
||||
setattr(self, "__ipa_api_domain", api_get_domain())
|
||||
return getattr(self, "__ipa_api_domain")
|
||||
|
||||
@staticmethod
|
||||
def ipa_get_realm():
|
||||
|
||||
Reference in New Issue
Block a user