Prevent utf-8 codec error in py3 (#44228)
Cannot upload templates in Python 3.x. Gives utf-8 codec error. Fixes this by opening the template file in binary mode.
This commit is contained in:
parent
aa07da21a3
commit
14e3febb2c
1 changed files with 1 additions and 1 deletions
|
@ -136,7 +136,7 @@ def get_template(proxmox, node, storage, content_type, template):
|
||||||
|
|
||||||
|
|
||||||
def upload_template(module, proxmox, api_host, node, storage, content_type, realpath, timeout):
|
def upload_template(module, proxmox, api_host, node, storage, content_type, realpath, timeout):
|
||||||
taskid = proxmox.nodes(node).storage(storage).upload.post(content=content_type, filename=open(realpath))
|
taskid = proxmox.nodes(node).storage(storage).upload.post(content=content_type, filename=open(realpath, 'rb'))
|
||||||
while timeout:
|
while timeout:
|
||||||
task_status = proxmox.nodes(api_host.split('.')[0]).tasks(taskid).status.get()
|
task_status = proxmox.nodes(api_host.split('.')[0]).tasks(taskid).status.get()
|
||||||
if task_status['status'] == 'stopped' and task_status['exitstatus'] == 'OK':
|
if task_status['status'] == 'stopped' and task_status['exitstatus'] == 'OK':
|
||||||
|
|
Loading…
Reference in a new issue