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
This commit is contained in:
Brian C. Lane 2018-11-02 11:49:02 -07:00
parent d37cf8d0d5
commit aa240fb591
2 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,7 @@
<os>
<loader dev='hd'/>
</os>
%for disk, letter in zip(disks, xrange(97, 123)):
%for disk, letter in zip(disks, range(97, 123)):
<drive disk='${disk.name}' target='hd${chr(letter)}'/>
%endfor
</boot>

View File

@ -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: