Skip to content

Commit b6df0cd

Browse files
authored
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
1 parent c5e9620 commit b6df0cd

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

system/hardware/tici/agnos.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,18 @@ def extract_casync_image(target_slot_number: int, partition: dict, cloudlog):
186186

187187
sources: List[Tuple[str, casync.ChunkReader, casync.ChunkDict]] = []
188188

189-
# First source is the current partition. Index file for current version is provided in the manifest
190-
raw_hash = get_raw_hash(seed_path, partition['size'])
191-
caibx_url = f"{CAIBX_URL}{partition['name']}-{raw_hash}.caibx"
189+
# First source is the current partition.
192190
try:
193-
cloudlog.info(f"casync fetching {caibx_url}")
194-
sources += [('seed', casync.FileChunkReader(seed_path), casync.build_chunk_dict(casync.parse_caibx(caibx_url)))]
195-
except requests.RequestException:
196-
cloudlog.error(f"casync failed to load {caibx_url}")
191+
raw_hash = get_raw_hash(seed_path, partition['size'])
192+
caibx_url = f"{CAIBX_URL}{partition['name']}-{raw_hash}.caibx"
193+
194+
try:
195+
cloudlog.info(f"casync fetching {caibx_url}")
196+
sources += [('seed', casync.FileChunkReader(seed_path), casync.build_chunk_dict(casync.parse_caibx(caibx_url)))]
197+
except requests.RequestException:
198+
cloudlog.error(f"casync failed to load {caibx_url}")
199+
except Exception:
200+
cloudlog.exception("casync failed to hash seed partition")
197201

198202
# Second source is the target partition, this allows for resuming
199203
sources += [('target', casync.FileChunkReader(path), casync.build_chunk_dict(target))]

0 commit comments

Comments
 (0)