summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSushil Gupta <susgupta@redhat.com>2020-11-11 16:53:36 +0530
committerVaibhav Mahajan <vamahaja@redhat.com>2020-12-03 06:26:45 +0000
commit210c86b35e8d42cc81e5387da981b5518352eb66 (patch)
tree8d19e45a57270e98348a7d59538804b7ea3ec923
parent3f0af17da98880664e01f8ac472dde653482127a (diff)
[LibFix] Add parameter to lib 'oc_delete' to check resource presence
Change-Id: I3382f9c52013a58f038f28b1c3d64a82ece813f6 Signed-off-by: Sushil Gupta <susgupta@redhat.com>
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/openshift_ops.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
index 5f53dab..fb60a00 100644
--- a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
+++ b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
@@ -483,7 +483,8 @@ def oc_create_tiny_pod_with_volume(hostname, pvc_name, pod_name_prefix='',
def oc_delete(
- ocp_node, rtype, name, raise_on_absence=True, collect_logs=False):
+ ocp_node, rtype, name, raise_on_absence=True, collect_logs=False,
+ skip_res_validation=True):
"""Delete an OCP resource by name
Args:
@@ -495,8 +496,10 @@ def oc_delete(
else return
default value: True
collect_logs (bool): Collect logs before deleting resource
+ skip_res_validation(bool): To validate before deletion of resource.
"""
- if not oc_get_yaml(ocp_node, rtype, name, raise_on_error=raise_on_absence):
+ if skip_res_validation and not oc_get_yaml(
+ ocp_node, rtype, name, raise_on_error=raise_on_absence):
return
if rtype == "pod" and collect_logs: