utils: consolidate logging to write checksum file to cache

Move log message to function that is called both by unicast and tiptorrent.
master
OpenGnSys Support Team 2024-07-21 21:56:09 +02:00
parent 8ac8dc306e
commit 59ab9204ce
1 changed files with 3 additions and 2 deletions

View File

@ -50,6 +50,9 @@ def tip_write_csum(image_name):
if not os.path.exists(image_path):
raise OgError(f'Invalid image path {image_path} for tiptorrent checksum writing')
logging.info('Calculating checksum...')
logging.info('*DO NOT REBOOT OR POWEROFF* the client during this time')
filename = image_path + ".full.sum"
csum = _compute_md5(image_path)
try:
@ -106,6 +109,4 @@ def tip_client_get(tip_addr, image_name):
if proc.returncode != 0:
raise OgError(f'Error fetching image {image_name} via tiptorrent')
else:
logging.info('Calculating checksum...')
logging.info('*DO NOT REBOOT OR POWEROFF* the client during this time')
tip_write_csum(image_name)