1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-22 13:19:13 +00:00

uv_python module: improve latest state check mode to show version that will be installed

This commit is contained in:
Mariam Ahhttouche 2026-02-13 16:31:02 +01:00
parent 87ad81992d
commit 396fc6cbb2

View file

@ -101,10 +101,11 @@ class UV:
def upgrade_python(self):
rc, out, _ = self._find_python("--show-version")
detected_version = out.split()[0]
if rc == 0 and detected_version == self._get_latest_patch_release():
latest_version = self._get_latest_patch_release()
if rc == 0 and detected_version == latest_version:
return False, out
if self.module.check_mode:
return True, ""
return True, latest_version
cmd = [self.module.get_bin_path("uv", required=True), "python", "upgrade", self.python_version_str]
rc, out, _ = self.module.run_command(cmd, check_rc=True)