Fix traceback and allow installing roles with version None (#81849)

* Allow installing roles with version `None` from Galaxy

Co-authored-by: Matt Martz <matt@sivel.net>
This commit is contained in:
Sloane Hertel
2024-03-16 00:17:37 +00:00
committed by GitHub
co-authored by Matt Martz
parent 4000656849
commit 7adc146e2f
2 changed files with 3 additions and 1 deletions
@@ -0,0 +1,2 @@
bugfixes:
- ansible-galaxy role install - fix installing roles from Galaxy that have version ``None`` (https://github.com/ansible/ansible/issues/81832).
+1 -1
View File
@@ -297,7 +297,7 @@ class GalaxyRole(object):
# are no versions in the list, we'll grab the head
# of the master branch
if len(role_versions) > 0:
loose_versions = [LooseVersion(a.get('name', None)) for a in role_versions]
loose_versions = [v for a in role_versions if (v := LooseVersion()) and v.parse(a.get('name') or '') is None]
try:
loose_versions.sort()
except TypeError: