centralize getting the hash because duh

This commit is contained in:
2021-01-21 11:59:18 -05:00
parent 0e8d460565
commit e8a75a42df
4 changed files with 35 additions and 37 deletions

14
arch.py
View File

@@ -13,7 +13,6 @@
import datetime
import json
import hashlib
import os
import re
##
@@ -133,17 +132,14 @@ class Updater(_base.BaseUpdater):
# if ver_info.get('arch') != self.arch:
# self.do_update = True
# self.force_update = True
try:
hasher = hashlib.new(self.hash_type)
with open(self.dest_iso, 'rb') as fh:
hasher.update(fh.read())
if self.old_hash != hasher.hexdigest().lower():
self.do_update = True
self.force_update = True
except FileNotFoundError:
if not os.path.isfile(self.dest_iso):
self.do_update = True
self.force_update = True
return(None)
realhash = self.getISOHash()
if self.old_hash != realhash:
self.do_update = True
self.force_update = True
return(None)
def getNet(self):