Skip to content

Commit

Permalink
add deprecation warning for remove garbage collector dead code (#2253)
Browse files Browse the repository at this point in the history
* remove garbage collector dead code

* Update datavolume.py

* Update datavolume.py

* Update datavolume.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update datavolume.py

* Update datavolume.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Ahmad-Hafe and pre-commit-ci[bot] authored Jan 23, 2025
1 parent f9c6879 commit 7f0771b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ocp_resources/datavolume.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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


class DataVolume(NamespacedResource):
Expand Down Expand Up @@ -281,7 +282,7 @@ def wait_for_dv_success(
Args:
timeout (int): Time to wait for the DataVolume to succeed.
failure_timeout (int): Time to wait for the DataVolume to have not Pending/None status
dv_garbage_collection_enabled (bool, default: False): if True, expect that DV will disappear after success
dv_garbage_collection_enabled (bool, default: False): DV garbage collection is deprecated and removed in v4.19
stop_status_func (function): function that is called inside the TimeoutSampler
if it returns True - stop the Sampler and raise TimeoutExpiredError
Example:
Expand All @@ -307,6 +308,8 @@ def test_dv():
wait_timeout=timeout,
func=lambda: self.exists,
):
if dv_garbage_collection_enabled is not None:
warn("garbage collector is deprecated and removed in version v4.19", DeprecationWarning)
# DV reach success if the status is Succeeded, or if DV garbage collection enabled and the DV does not exist
if sample and sample.get("status", {}).get("phase") == self.Status.SUCCEEDED:
break
Expand Down

0 comments on commit 7f0771b

Please sign in to comment.