canonical / craft-providers

Python interfaces for instantiating and executing builds for a variety of target environments.
https://canonical-craft-providers.readthedocs-hosted.com/en/latest/
GNU Lesser General Public License v3.0
6 stars 20 forks source link

Make LXD version check more robust #535

Open mr-cal opened 4 months ago

mr-cal commented 4 months ago

What needs to get done

If LXD version parsing fails, craft-providers should catch the failure and log a warning.

Why it needs to get done

LXD recently changed their version naming convention, which broke craft-providers and had to be fixed via #532. This check should be more robust.

syncronize-issues-to-jira[bot] commented 4 months ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-2619.

This message was autogenerated

lengau commented 3 months ago

From the LXD team (@tomponline):

The CLI output isn't guaranteed to be stable, so perhaps a better way is to use the API directly, i.e.

lxc query /1.0 | jq .environment.server_version
"5.21.1"

The API version server_version didn't change, and instead we added a new server_lts field.

so querying the API directly is the right way to go

simondeziel commented 1 month ago

Just an FYI, that currently there is a bug in lxd-installer (a kind of shim to dynamically install LXD's snap if it's not present) that prevents the suggested detection mechanism from working.

Until that bug fix is propagated to all supported releases, please make sure to test on systems where the LXD snap is installed rather than rely on lxd-installer to pull it.