|
24 | 24 | from typing import List, Any, Tuple, Callable, Dict, Optional |
25 | 25 | from charon.config import RadasConfig |
26 | 26 | from charon.pkgs.oras_client import OrasClient |
| 27 | +from charon.utils import files |
27 | 28 | from proton import SSLDomain, Message, Event, Sender, Connection |
28 | 29 | from proton.handlers import MessagingHandler |
29 | 30 | from proton.reactor import Container |
@@ -327,20 +328,25 @@ async def generate_single_sign_file( |
327 | 328 | signature_path = os.path.join(top_level, asc_filename) |
328 | 329 |
|
329 | 330 | if not os.path.isfile(artifact_path): |
330 | | - logger.warning("Artifact missing, skip signature file generation") |
| 331 | + logger.warning( |
| 332 | + "Artifact %s missing, skip signature file generation.", |
| 333 | + artifact_path) |
331 | 334 | return |
332 | 335 |
|
333 | 336 | try: |
334 | | - with open(signature_path, "w") as asc_file: |
335 | | - asc_file.write(signature) |
| 337 | + files.overwrite_file(signature_path, signature) |
336 | 338 | generated_signs.append(signature_path) |
337 | | - logger.info("Generated .asc file: %s", signature_path) |
| 339 | + logger.debug("Generated .asc file: %s", signature_path) |
338 | 340 | except Exception as e: |
339 | 341 | failed_paths.append(signature_path) |
340 | 342 | logger.error("Failed to write .asc file for %s: %s", artifact_path, e) |
341 | 343 |
|
342 | 344 | result = data.get("results", []) |
343 | | - return __do_path_cut_and(path_handler=generate_single_sign_file, data=result) |
| 345 | + (_failed_metas, _generated_signs) = __do_path_cut_and(generate_single_sign_file, result) |
| 346 | + logger.info( |
| 347 | + "Signature generation done. There are %s signature files generated.", |
| 348 | + len(_generated_signs)) |
| 349 | + return (_failed_metas, _generated_signs) |
344 | 350 |
|
345 | 351 |
|
346 | 352 | def __do_path_cut_and( |
|
0 commit comments