Skip to content

Commit

Permalink
refactor: Rename exported_errors in status.json (#4500)
Browse files Browse the repository at this point in the history
This key had more meaning to a developer than to a user. Replace with
"recoverable_errors", and align internal variable names with external
user UI for code legibility.
  • Loading branch information
holmanb committed Nov 14, 2023
1 parent 6040366 commit 3cec4bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cloudinit/cmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ def status_wrapper(name, args, data_d=None, link_d=None):
v1 = status["v1"]
v1["stage"] = mode
v1[mode]["start"] = time.time()
v1[mode]["exported_errors"] = next(
v1[mode]["recoverable_errors"] = next(
filter(lambda h: isinstance(h, LogExporter), root_logger.handlers)
).export_logs()

Expand Down Expand Up @@ -788,7 +788,7 @@ def status_wrapper(name, args, data_d=None, link_d=None):
v1["stage"] = None

# Write status.json after running init / module code
v1[mode]["exported_errors"] = next(
v1[mode]["recoverable_errors"] = next(
filter(lambda h: isinstance(h, LogExporter), root_logger.handlers)
).export_logs()
atomic_helper.write_json(status_path, status)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/cmd/test_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ def test_status_json_errors(client):
"""Ensure that deprecated logs end up in the exported errors"""
assert json.loads(
client.execute("cat /run/cloud-init/status.json").stdout
)["v1"]["init"]["exported_errors"].get("DEPRECATED")
)["v1"]["init"]["recoverable_errors"].get("DEPRECATED")

0 comments on commit 3cec4bc

Please sign in to comment.