mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-22 05:09:12 +00:00
Handle case when version given is an empty string in uv_python module
This commit is contained in:
parent
722c9441c5
commit
a21646d398
2 changed files with 18 additions and 4 deletions
|
|
@ -118,10 +118,9 @@ class UV:
|
|||
self.bin_path = self.module.get_bin_path("uv", required=True)
|
||||
self._ensure_min_uv_version()
|
||||
try:
|
||||
python_version = module.params["version"]
|
||||
self.python_version = StrictVersion(python_version)
|
||||
self.python_version = StrictVersion(module.params["version"])
|
||||
self.python_version_str = str(self.python_version)
|
||||
except ValueError:
|
||||
except (ValueError, AttributeError):
|
||||
self.module.fail_json(
|
||||
msg="Unsupported version format. Valid version numbers consist of two or three dot-separated numeric components, \
|
||||
with an optional 'pre-release' tag on the end (e.g. 3.12, 3.12.3, 3.15.0a5) are supported in this release."
|
||||
|
|
|
|||
|
|
@ -257,10 +257,25 @@
|
|||
- name: No specified version
|
||||
uv_python:
|
||||
state: latest
|
||||
version: ""
|
||||
ignore_errors: true
|
||||
register: no_version
|
||||
|
||||
- name: Verify failure when no version is specified
|
||||
assert:
|
||||
that:
|
||||
- no_version.failed is true
|
||||
- no_version.failed is true
|
||||
- '"Unsupported version format" in no_version.msg'
|
||||
|
||||
- name: Unsupported version format given
|
||||
uv_python:
|
||||
state: latest
|
||||
version: "3.8.post2"
|
||||
ignore_errors: true
|
||||
register: wrong_version
|
||||
|
||||
- name: Verify failure when unsupported version format is specified
|
||||
assert:
|
||||
that:
|
||||
- wrong_version.failed is true
|
||||
- '"Unsupported version format" in wrong_version.msg'
|
||||
Loading…
Add table
Add a link
Reference in a new issue