vmware: find_vmdk_file with trailing / (#55957)
With the example, the `file_result.folderPath` of the file does not have any trailing '/'. `target_folder_path` is correctly generated and equal: `[nfs_1] images`.
This commit is contained in:
parent
d55c0cf8dc
commit
7a02c40bbc
1 changed files with 5 additions and 2 deletions
|
@ -1276,11 +1276,14 @@ class PyVmomi(object):
|
|||
if not changed:
|
||||
self.module.fail_json(msg="No valid disk vmdk image found for path %s" % vmdk_path)
|
||||
|
||||
target_folder_path = datastore_name_sq + " " + vmdk_folder + '/'
|
||||
target_folder_paths = [
|
||||
datastore_name_sq + " " + vmdk_folder + '/',
|
||||
datastore_name_sq + " " + vmdk_folder,
|
||||
]
|
||||
|
||||
for file_result in search_res.info.result:
|
||||
for f in getattr(file_result, 'file'):
|
||||
if f.path == vmdk_filename and file_result.folderPath == target_folder_path:
|
||||
if f.path == vmdk_filename and file_result.folderPath in target_folder_paths:
|
||||
return f
|
||||
|
||||
self.module.fail_json(msg="No vmdk file found for path specified [%s]" % vmdk_path)
|
||||
|
|
Loading…
Reference in a new issue