Skip to content

fix(analyze): warn before GNU date fallback#6879

Open
nanookclaw wants to merge 3 commits into
canonical:mainfrom
nanookclaw:fix/analyze-date-warning
Open

fix(analyze): warn before GNU date fallback#6879
nanookclaw wants to merge 3 commits into
canonical:mainfrom
nanookclaw:fix/analyze-date-warning

Conversation

@nanookclaw

@nanookclaw nanookclaw commented May 12, 2026

Copy link
Copy Markdown

Summary

Adds a transitional warning when cloud-init analyze dump falls back to GNU date/gdate for timestamp parsing. The warning includes the unrecognized timestamp format and the selected binary so maintainers can collect formats that still need native Python support before removing the shell-out path.

The no-GNU-date behavior is unchanged: unsupported formats still raise ValueError when neither date nor gdate is available.

Fixes #4357.

Testing

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest -q tests/unittests/analyze/test_dump.py
  • git diff --check

Plain pytest in this environment auto-loads a missing external plugin (evalcraft), so I disabled plugin autoload for the focused test run.

Signed-off-by: Nanook <nanookclaw@users.noreply.github.com>
Signed-off-by: Nanook <nanookclaw@users.noreply.github.com>

@holmanb holmanb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix comments and failing tests.

Comment on lines -225 to 290
SAMPLE_LOGS = dedent(
"""\
SAMPLE_LOGS = dedent("""\
Nov 03 06:51:06.074410 x2 cloud-init[106]: [CLOUDINIT] util.py[DEBUG]:\
Cloud-init v. 0.7.8 running 'init-local' at Thu, 03 Nov 2016\
06:51:06 +0000. Up 1.0 seconds.
2016-08-30 21:53:25.972325+00:00 y1 [CLOUDINIT] handlers.py[DEBUG]: finish:\
modules-final: SUCCESS: running modules for final
"""
)
""")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This formatting changes seem unrelated to this PR.

@nanookclaw

Copy link
Copy Markdown
Author

Pushed e7b5f5c to restore the unrelated SAMPLE_LOGS formatting change and satisfy the check_format failure from Black 25.1.

Local verification:

  • uvx --from black==25.1.0 black --check tests/unittests/analyze/test_dump.py
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest -q tests/unittests/analyze/test_dump.py (16 passed)
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't Depend on GNU Date

2 participants