mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
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.
This commit is contained in:
@@ -78,6 +78,9 @@ import socket
|
|||||||
def vmware_path(datastore, datacenter, path):
|
def vmware_path(datastore, datacenter, path):
|
||||||
''' Constructs a URL path that VSphere accepts reliably '''
|
''' Constructs a URL path that VSphere accepts reliably '''
|
||||||
path = "/folder/%s" % path.lstrip("/")
|
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("/"):
|
if not path.startswith("/"):
|
||||||
path = "/" + path
|
path = "/" + path
|
||||||
params = dict( dsName = datastore )
|
params = dict( dsName = datastore )
|
||||||
|
|||||||
Reference in New Issue
Block a user