def load_config(self, config):
with open(config) as c:
cfg = json.load(c)
m = hashlib.sha224()
m.update(bytes(cfg['subnet'], 'utf-8'))
m.update(bytes(cfg['swap_size']))
m.update(bytes(cfg['root_size']))
m.update(bytes(cfg['extra_args'], 'utf-8'))
# TODO: check sizes
for f in cfg['hashes']:
with open(f, 'rb') as fl:
for line in fl:
m.update(line)
cfg['sha224'] = m.hexdigest()
cfg['subnet'] = ipaddress.ip_network(cfg['subnet'])
cfg['image_method'] = IMAGE_METHOD
return cfg
评论列表
文章目录