casync: handle hash failure (#25081)

* casync: handle hashing failure due to IO errors

* fix comment

* all exceptions

* fix typo

* Update system/hardware/tici/agnos.py
old-commit-hash: b6df0cd242
taco
Willem Melching 3 years ago committed by GitHub
parent ff8427318d
commit e737b50c2d
  1. 18
      system/hardware/tici/agnos.py

@ -186,14 +186,18 @@ def extract_casync_image(target_slot_number: int, partition: dict, cloudlog):
sources: List[Tuple[str, casync.ChunkReader, casync.ChunkDict]] = [] sources: List[Tuple[str, casync.ChunkReader, casync.ChunkDict]] = []
# First source is the current partition. Index file for current version is provided in the manifest # First source is the current partition.
raw_hash = get_raw_hash(seed_path, partition['size'])
caibx_url = f"{CAIBX_URL}{partition['name']}-{raw_hash}.caibx"
try: try:
cloudlog.info(f"casync fetching {caibx_url}") raw_hash = get_raw_hash(seed_path, partition['size'])
sources += [('seed', casync.FileChunkReader(seed_path), casync.build_chunk_dict(casync.parse_caibx(caibx_url)))] caibx_url = f"{CAIBX_URL}{partition['name']}-{raw_hash}.caibx"
except requests.RequestException:
cloudlog.error(f"casync failed to load {caibx_url}") try:
cloudlog.info(f"casync fetching {caibx_url}")
sources += [('seed', casync.FileChunkReader(seed_path), casync.build_chunk_dict(casync.parse_caibx(caibx_url)))]
except requests.RequestException:
cloudlog.error(f"casync failed to load {caibx_url}")
except Exception:
cloudlog.exception("casync failed to hash seed partition")
# Second source is the target partition, this allows for resuming # Second source is the target partition, this allows for resuming
sources += [('target', casync.FileChunkReader(path), casync.build_chunk_dict(target))] sources += [('target', casync.FileChunkReader(path), casync.build_chunk_dict(target))]

Loading…
Cancel
Save