From f987b932207dcb2d3da0b9edd0105eabccdebc7c Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Fri, 12 Apr 2024 09:23:57 +0200 Subject: [PATCH] Fix issue in teardown when folder vsphere doesn't exist Fixes: #9669 Signed-off-by: Petr Balogh --- ocs_ci/utility/vsphere.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ocs_ci/utility/vsphere.py b/ocs_ci/utility/vsphere.py index 2da26b7131b..3c0774d7dbc 100644 --- a/ocs_ci/utility/vsphere.py +++ b/ocs_ci/utility/vsphere.py @@ -785,8 +785,19 @@ def check_folder_exists(self, name, cluster, dc): vms = dc.vmFolder.childEntity for vm in vms: - if vm.name == name: - _rc = True + try: + if vm.name == name: + _rc = True + except vmodl.fault.ManagedObjectNotFound as ex: + logger.exception( + "There was an exception hit while attempting to check if folder exists!" + ) + if ( + "has already been deleted or has not been completely create" + not in str(ex) + ): + raise + return _rc def destroy_folder(self, name, cluster, dc):