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.
pull/44593/head
Jose Rodriguez 6 years ago committed by ansibot
parent aa07da21a3
commit 14e3febb2c

@ -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):
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:
task_status = proxmox.nodes(api_host.split('.')[0]).tasks(taskid).status.get()
if task_status['status'] == 'stopped' and task_status['exitstatus'] == 'OK':

Loading…
Cancel
Save