From ada6159ecec1e57fca3629e1e0325378f636fe1e Mon Sep 17 00:00:00 2001 From: Mike Klebolt Date: Tue, 10 Oct 2017 02:14:12 -0500 Subject: [PATCH] first path check missing forward slash between dcpath and datacenter (#31481) * fixed folder path logic * fixed folder path logic * fixed folder path logic --- lib/ansible/modules/cloud/vmware/vmware_guest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest.py b/lib/ansible/modules/cloud/vmware/vmware_guest.py index c4dfad2f02..66644032dd 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_guest.py +++ b/lib/ansible/modules/cloud/vmware/vmware_guest.py @@ -1110,7 +1110,8 @@ class PyVmomiHelper(PyVmomi): dcpath = compile_folder_path_for_object(datacenter) # Check for full path first in case it was already supplied - if (self.params['folder'].startswith(dcpath + self.params['datacenter'] + '/vm')): + if (self.params['folder'].startswith(dcpath + self.params['datacenter'] + '/vm') or + self.params['folder'].startswith(dcpath + '/' + self.params['datacenter'] + '/vm')): fullpath = self.params['folder'] elif (self.params['folder'].startswith('/vm/') or self.params['folder'] == '/vm'): fullpath = "%s%s%s" % (dcpath, self.params['datacenter'], self.params['folder'])