From ab7a8a6a11d1c8154e9ae647e8478649deb84f31 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Mon, 29 Jun 2015 17:08:48 +0200 Subject: [PATCH] Work around a software bug in vSphere Due to a software bug in vSphere, it fails to handle ampersand in datacenter names. The solution is to do what vSphere does (when browsing) and double-encode ampersands. It is likely other characters need special treatment like this as well, haven't found any. --- lib/ansible/modules/extras/cloud/vmware/vsphere_copy.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/modules/extras/cloud/vmware/vsphere_copy.py b/lib/ansible/modules/extras/cloud/vmware/vsphere_copy.py index 7c044a7d51a..44e20caebdf 100644 --- a/lib/ansible/modules/extras/cloud/vmware/vsphere_copy.py +++ b/lib/ansible/modules/extras/cloud/vmware/vsphere_copy.py @@ -78,6 +78,9 @@ import socket def vmware_path(datastore, datacenter, path): ''' Constructs a URL path that VSphere accepts reliably ''' path = "/folder/%s" % path.lstrip("/") + # Due to a software bug in vSphere, it fails to handle ampersand in datacenter names + # The solution is to do what vSphere does (when browsing) and double-encode ampersands, maybe others ? + datacenter = datacenter.replace('&', '%26') if not path.startswith("/"): path = "/" + path params = dict( dsName = datastore )