Skip to content

Commit 7d44499

Browse files
committed
Fix possible migration hazard, not in cache if no cache
1 parent b94b9e5 commit 7d44499

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ansible_base/rbac/models/content_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def get_by_natural_key(self, *args: str) -> "DABContentType":
143143
kwargs = {'service__in': [get_local_resource_prefix(), 'shared'], 'app_label': app_label, 'model': model}
144144
# This ask here is actually ambiguous, so we try this extra lookup
145145
shared_key = ('shared', app_label, model)
146-
if ('shared', app_label, model) in self._cache[self.db]:
146+
if (self.db in self._cache) and (('shared', app_label, model) in self._cache[self.db]):
147147
return self._cache[self.db][shared_key]
148148
else:
149149
service, app_label, model = args

0 commit comments

Comments
 (0)