| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -176,13 +176,19 @@ def flash_partition(target_slot_number: int, partition: dict, cloudlog, spinner: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      out.write(partition['hash_raw'].lower().encode()) | 
					 | 
					 | 
					 | 
					      out.write(partition['hash_raw'].lower().encode()) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					def swap(manifest_path: str, target_slot_number: int) -> None: | 
					 | 
					 | 
					 | 
					def swap(manifest_path: str, target_slot_number: int, cloudlog) -> None: | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  update = json.load(open(manifest_path)) | 
					 | 
					 | 
					 | 
					  update = json.load(open(manifest_path)) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  for partition in update: | 
					 | 
					 | 
					 | 
					  for partition in update: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if not partition.get('full_check', False): | 
					 | 
					 | 
					 | 
					    if not partition.get('full_check', False): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      clear_partition_hash(target_slot_number, partition) | 
					 | 
					 | 
					 | 
					      clear_partition_hash(target_slot_number, partition) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  subprocess.check_output(f"abctl --set_active {target_slot_number}", shell=True) | 
					 | 
					 | 
					 | 
					  while True: | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    out = subprocess.check_output(f"abctl --set_active {target_slot_number}", shell=True, stderr=subprocess.STDOUT, encoding='utf8') | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    if ("No such file or directory" not in out) and ("lun as boot lun" in out): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      cloudlog.info(f"Swap successfull {out}") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      break | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    else: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      cloudlog.error(f"Swap failed {out}") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					def flash_agnos_update(manifest_path: str, target_slot_number: int, cloudlog, spinner: Optional[Spinner] = None) -> None: | 
					 | 
					 | 
					 | 
					def flash_agnos_update(manifest_path: str, target_slot_number: int, cloudlog, spinner: Optional[Spinner] = None) -> None: | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -246,6 +252,6 @@ if __name__ == "__main__": | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      flash_agnos_update(args.manifest, target_slot_number, logging, spinner) | 
					 | 
					 | 
					 | 
					      flash_agnos_update(args.manifest, target_slot_number, logging, spinner) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    logging.warning(f"Verification succeeded. Swapping to slot {target_slot_number}") | 
					 | 
					 | 
					 | 
					    logging.warning(f"Verification succeeded. Swapping to slot {target_slot_number}") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    swap(args.manifest, target_slot_number) | 
					 | 
					 | 
					 | 
					    swap(args.manifest, target_slot_number, logging) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  else: | 
					 | 
					 | 
					 | 
					  else: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    flash_agnos_update(args.manifest, target_slot_number, logging, spinner) | 
					 | 
					 | 
					 | 
					    flash_agnos_update(args.manifest, target_slot_number, logging, spinner) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
  |