mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-02 19:32:47 +00:00
Catch exception comparing role versions, and provide a user friendly error message. Fixes #32301 (#34427)
This commit is contained in:
@@ -234,7 +234,14 @@ class GalaxyRole(object):
|
||||
# of the master branch
|
||||
if len(role_versions) > 0:
|
||||
loose_versions = [LooseVersion(a.get('name', None)) for a in role_versions]
|
||||
loose_versions.sort()
|
||||
try:
|
||||
loose_versions.sort()
|
||||
except TypeError:
|
||||
raise AnsibleError(
|
||||
'Unable to compare role versions (%s) to determine the most recent version due to incompatible version formats. '
|
||||
'Please contact the role author to resolve versioning conflicts, or specify an explicit role version to '
|
||||
'install.' % ', '.join([v.vstring for v in loose_versions])
|
||||
)
|
||||
self.version = str(loose_versions[-1])
|
||||
elif role_data.get('github_branch', None):
|
||||
self.version = role_data['github_branch']
|
||||
|
||||
Reference in New Issue
Block a user