grafana-toolbox / grafana-client

Python client library for accessing the Grafana HTTP API.
MIT License
106 stars 30 forks source link

Updating Grafana version to Grafana v11.3.0-75420.patch2-75797 breaks the code #182

Closed Zhuse closed 1 month ago

Zhuse commented 1 month ago

Describe the bug

After updating our Grafana version to v11.3.0-75420.patch2-75797, verlib2 throws in InvalidVersion exception trying to parse it:

File "/home/airflow/.local/lib/python3.7/site-packages/grafana_client/elements/datasource.py", line 378, in smartquery elif datasource_type in ("prometheus", "loki") and Version(self.api.version) <= VERSION_7: File "/home/airflow/.local/lib/python3.7/site-packages/verlib2/version.py", line 200, in __init__ raise InvalidVersion(f"Invalid version: '{version}'")

To Reproduce Steps to reproduce the behavior:

  1. Call grafana_client.datasource.smartquery on a Grafana server deployed with a patch version.

Expected behavior Any deployed Grafana versions should be sanitized prior to parsing with verlib2.

Versions

amotl commented 1 month ago

Dear @Zhuse,

thanks a stack for your report.

Any deployed Grafana versions should be sanitized prior to parsing with verlib2.

We agree with your assessment, and will try to add an improvement for the upcoming release.

With kind regards, Andreas.

amotl commented 1 month ago

grafana-client 4.1.2, just published to PyPI, may improve the situation for you.

Zhuse commented 1 month ago

Appreciate it!