Skip to content

Commit

Permalink
remove garbage collector dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad-Hafe committed Dec 29, 2024
1 parent ecd22b4 commit 6a663b0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ocp_resources/datavolume.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from ocp_resources.persistent_volume_claim import PersistentVolumeClaim
from ocp_resources.resource import NamespacedResource, Resource
from timeout_sampler import TimeoutExpiredError, TimeoutSampler
from warnings import warn

gc_deprecatio_warning = ("garbage collector is removed in version v1.62 and going to be deprecated", DeprecationWarning)


class DataVolume(NamespacedResource):
Expand Down Expand Up @@ -311,6 +314,7 @@ def test_dv():
if sample and sample.get("status", {}).get("phase") == self.Status.SUCCEEDED:
break
elif sample is None and dv_garbage_collection_enabled:
warn(gc_deprecatio_warning)
break
elif stop_status_func and stop_status_func(*stop_status_func_args, **stop_status_func_kwargs):
raise TimeoutExpiredError(
Expand Down Expand Up @@ -343,4 +347,5 @@ def delete(self, wait=False, timeout=TIMEOUT_4MINUTES, body=None):
if self.exists:
return super().delete(wait=wait, timeout=timeout, body=body)
else:
warn(gc_deprecatio_warning)
return self.pvc.delete(wait=wait, timeout=timeout, body=body)

0 comments on commit 6a663b0

Please sign in to comment.