Repository navigation
Conversation
|
@fabaff @engrbm87 this now breaks the Glances integration in Home Assistant 2026.12.0 (home-assistant/core#196391), since core ships 0.11.0. Could it go out in a 0.11.1? I'll send the core bump as soon as it's released. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In 0.11.0, an AMP result such as
"No running process"makesget_ha_sensor_data()raiseIndexError, interrupting the entire sensor update. The parser indexes the first match of^\d+even when the result has no numeric prefix. Empty strings fail the same way.This is valid Glances output: Glances sets this result when no process matches an AMP configured with a positive minimum process count. Its AMP interface allows string results.
Use
re.match()and check for a match before reading the prefix. Preserve the original result text and numeric prefixes as strings. Results without a numeric prefix get integer0, following the existing fallback forNone. This is a compatibility fallback: the result text contains no leading numeric count. The existingNoneresult behavior stays the same.The regression test mocks the HTTP response and exercises the real client, checking the complete sensor response for
None, empty text,"No running process", other text, a numeric prefix, and a zero prefix.Validation on macOS arm64:
pytest tests/ -q: 14 passed on Python 3.13.17, 3.14.9, and 3.15.0."No running process", and plain-text cases fail withIndexError(3 failed, 11 passed).ruff check .: passed on all three Python environments.mypy glances_api: passed on Python 3.14.9.git diff --check: passed.AI assistance was used to prepare the change and tests.