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

View File

@ -9,7 +9,7 @@
<os> <os>
<loader dev='hd'/> <loader dev='hd'/>
</os> </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)}'/> <drive disk='${disk.name}' target='hd${chr(letter)}'/>
%endfor %endfor
</boot> </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) log.info("Calculating SHA256 checksum of %s", disk_img)
sha256 = hashlib.sha256() sha256 = hashlib.sha256()
with open(disk_img) as f: with open(disk_img, "rb") as f:
while True: while True:
data = f.read(1024**2) data = f.read(1024**2)
if not data: if not data: