Skip to content

Commit

Permalink
counter conversion: continue upon error
Browse files Browse the repository at this point in the history
Change-Id: I0b9670cc43717e5e6e9d666d1396b9f319266df6
  • Loading branch information
mo-ki committed Jan 16, 2025
1 parent bb1cb8f commit fed7bfa
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions cmk/update_config/plugins/actions/counters_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,17 @@ def convert_counter_files(counters_path: Path, logger: Logger) -> None:
continue

logger.debug(msg_temp, "converting", f)
f.write_text(
json.dumps(
[(k, repr(v)) for k, v in ast.literal_eval(content).items()],
try:
f.write_text(
json.dumps(
[(k, repr(v)) for k, v in ast.literal_eval(content).items()],
)
)
)
except Exception as exc:
# We've seen this conversion fail upon what seemed to be partially written files.
# After the fact, we've never seen any traces of them.
# At least continue with all the other files.
logger.warning(msg_temp, f"failed ({exc})", f)


update_action_registry.register(
Expand Down

0 comments on commit fed7bfa

Please sign in to comment.