From 5fa5b8e142a1467251b78e8d8d9f22c5a4a40d1d Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 2 Nov 2018 11:49:02 -0700 Subject: [PATCH] Fix make_appliance and the libvirt.tmpl Apparently nobody has used these since the switch to py3, xrange is now range and it needs to read the file in binary mode when generating the sha256. (cherry picked from commit 8e749efbbfda67bef67419b5fbc61b5d5b134da5) --- share/templates.d/99-generic/appliance/libvirt.tmpl | 2 +- src/pylorax/creator.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/templates.d/99-generic/appliance/libvirt.tmpl b/share/templates.d/99-generic/appliance/libvirt.tmpl index a739e635..b6ffc613 100644 --- a/share/templates.d/99-generic/appliance/libvirt.tmpl +++ b/share/templates.d/99-generic/appliance/libvirt.tmpl @@ -9,7 +9,7 @@ -%for disk, letter in zip(disks, xrange(97, 123)): +%for disk, letter in zip(disks, range(97, 123)): %endfor diff --git a/src/pylorax/creator.py b/src/pylorax/creator.py index 3a5fa029..72b1a09e 100644 --- a/src/pylorax/creator.py +++ b/src/pylorax/creator.py @@ -155,7 +155,7 @@ def make_appliance(disk_img, name, template, outfile, networks=None, ram=1024, log.info("Calculating SHA256 checksum of %s", disk_img) sha256 = hashlib.sha256() - with open(disk_img) as f: + with open(disk_img, "rb") as f: while True: data = f.read(1024**2) if not data: