BUG: https://bugzilla.samba.org/show_bug.cgi?id=14642
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
def get_cached_creds(self, *,
machine_account,
- opts=None):
+ opts=None,
+ use_cache=True):
if opts is None:
opts = {}
cache_key = tuple(sorted(account_opts.items()))
- creds = self.account_cache.get(cache_key)
- if creds is None:
- creds = self.create_account_opts(**account_opts)
+ if use_cache:
+ creds = self.account_cache.get(cache_key)
+ if creds is not None:
+ return creds
+
+ creds = self.create_account_opts(**account_opts)
+ if use_cache:
self.account_cache[cache_key] = creds
return creds