Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some multipass dev versions are considered invalid #661

Open
lengau opened this issue Sep 24, 2024 · 1 comment · Fixed by #662
Open

Some multipass dev versions are considered invalid #661

lengau opened this issue Sep 24, 2024 · 1 comment · Fixed by #662
Labels
Bug Something isn't working triaged We will be doing this

Comments

@lengau
Copy link
Contributor

lengau commented Sep 24, 2024

Bug Description

See: canonical/charmcraft#1917

Using packaging.version.parse to parse the multipass version '1.15.0-dev.2929.pr661' raises an InvalidVersion, which isn't caught and bubbles up.

We might be able to work around this by replacing hyphens with periods, turning semver strings into pypa compliant versions. Otherwise, we could truncate at the first hyphen and attempt to use that, perhaps with a warning.

Regardless, we should catch the InvalidVersion error and replace it with something nicer.

To Reproduce

Use that version of multipass on a mac

part yaml

n/a

Relevant log output

2024-09-24 19:00:16.880 Executing on host: multipass version
2024-09-24 19:00:16.926 charmcraft internal error: InvalidVersion("Invalid version: '1.15.0-dev.2929.pr661'")
2024-09-24 19:00:16.928 Traceback (most recent call last):
2024-09-24 19:00:16.928   File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/craft_application/application.py", line 543, in run
2024-09-24 19:00:16.928     self.run_managed(platform, build_for)
2024-09-24 19:00:16.928   File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/charmcraft/application/main.py", line 154, in run_managed
2024-09-24 19:00:16.928     super().run_managed(platform, build_for)
2024-09-24 19:00:16.928   File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/craft_application/application.py", line 368, in run_managed
2024-09-24 19:00:16.928     with self.services.provider.instance(
2024-09-24 19:00:16.928   File "/Users/X/.pyenv/versions/3.10.11/lib/python3.10/contextlib.py", line 135, in __enter__
2024-09-24 19:00:16.928     return next(self.gen)
2024-09-24 19:00:16.928   File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/charmcraft/services/provider.py", line 119, in instance
2024-09-24 19:00:16.928     with super().instance(
2024-09-24 19:00:16.928   File "/Users/X/.pyenv/versions/3.10.11/lib/python3.10/contextlib.py", line 135, in __enter__
2024-09-24 19:00:16.928     return next(self.gen)
2024-09-24 19:00:16.928   File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/craft_application/services/provider.py", line 126, in instance
2024-09-24 19:00:16.928     provider.ensure_provider_is_available()
2024-09-24 19:00:16.928   File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/craft_providers/multipass/multipass_provider.py", line 165, in ensure_provider_is_available
2024-09-24 19:00:16.928     ensure_multipass_is_ready()
2024-09-24 19:00:16.928   File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/craft_providers/multipass/_ready.py", line 41, in ensure_multipass_is_ready
2024-09-24 19:00:16.928     if not multipass.is_supported_version():
2024-09-24 19:00:16.928   File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/craft_providers/multipass/multipass.py", line 161, in is_supported_version
2024-09-24 19:00:16.928     return packaging.version.parse(version) >= minimum_version
2024-09-24 19:00:16.928   File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/packaging/version.py", line 56, in parse
2024-09-24 19:00:16.928     return Version(version)
2024-09-24 19:00:16.928   File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/packaging/version.py", line 202, in __init__
2024-09-24 19:00:16.928     raise InvalidVersion(f"Invalid version: '{version}'")
2024-09-24 19:00:16.928 packaging.version.InvalidVersion: Invalid version: '1.15.0-dev.2929.pr661'
2024-09-24 19:00:16.928 Full execution log: '/Users/X/Library/Logs/charmcraft/charmcraft-20240924-190016.856344.log'
@lengau lengau added Bug Something isn't working triaged We will be doing this labels Sep 24, 2024
Copy link

Thank you for reporting us your feedback!

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

This message was autogenerated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working triaged We will be doing this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant