From aa240fb591b5edfb48d5be86f394a19d8d9377ab 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. Related: rhbz#1673744 --- 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 0ae6fc8e..10972ff5 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: