Skip to content

Commit 7f0771b

Browse files
add deprecation warning for remove garbage collector dead code (#2253)
* 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>
1 parent f9c6879 commit 7f0771b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ocp_resources/datavolume.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from ocp_resources.persistent_volume_claim import PersistentVolumeClaim
99
from ocp_resources.resource import NamespacedResource, Resource
1010
from timeout_sampler import TimeoutExpiredError, TimeoutSampler
11+
from warnings import warn
1112

1213

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

0 commit comments

Comments
 (0)