Improve cached data deletion

This commit is contained in:
Tobias Kunze 2025-05-21 09:16:43 +02:00
parent 8a67e16a0b
commit ba30fb0402

View file

@ -518,14 +518,14 @@ class ServiceInstance(ServalaModelMixin, models.Model):
def _clear_kubernetes_caches(self): def _clear_kubernetes_caches(self):
"""Clears cached properties that depend on Kubernetes state.""" """Clears cached properties that depend on Kubernetes state."""
attrs = self.__dict__.keys() attrs = self.__dict__.keys()
if "kubernetes_object" in attrs: for key in (
del self.kubernetes_object "kubernetes_object",
if "spec" in attrs: "spec",
del self.spec "status_conditions",
if "status_conditions" in attrs: "connection_credentials",
del self.status_conditions ):
if "connection_credentials" in attrs: if key in attrs:
del self.connection_credentials delattr(self, key)
@classmethod @classmethod
def create_instance(cls, name, organization, context, created_by, spec_data): def create_instance(cls, name, organization, context, created_by, spec_data):