VMware: Add url quoting to support spaces in paths provided by the user (#46708)
This commit is contained in:
parent
c779ef5313
commit
8f7c857960
1 changed files with 2 additions and 2 deletions
|
@ -100,14 +100,14 @@ import socket
|
|||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlencode, quote
|
||||
from ansible.module_utils._text import to_native
|
||||
from ansible.module_utils.urls import open_url
|
||||
|
||||
|
||||
def vmware_path(datastore, datacenter, path):
|
||||
''' Constructs a URL path that VSphere accepts reliably '''
|
||||
path = "/folder/%s" % path.lstrip("/")
|
||||
path = "/folder/%s" % quote(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')
|
||||
|
|
Loading…
Reference in a new issue