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):
"""Clears cached properties that depend on Kubernetes state."""
attrs = self.__dict__.keys()
if "kubernetes_object" in attrs:
del self.kubernetes_object
if "spec" in attrs:
del self.spec
if "status_conditions" in attrs:
del self.status_conditions
if "connection_credentials" in attrs:
del self.connection_credentials
for key in (
"kubernetes_object",
"spec",
"status_conditions",
"connection_credentials",
):
if key in attrs:
delattr(self, key)
@classmethod
def create_instance(cls, name, organization, context, created_by, spec_data):