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>
pull/81672/head
Sloane Hertel 2 months ago committed by GitHub
parent 4000656849
commit 7adc146e2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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).

@ -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:

Loading…
Cancel
Save