diff options
-rw-r--r-- | changelogs/fragments/dont_assume_role_versions.yml | 2 | ||||
-rw-r--r-- | lib/ansible/galaxy/api.py | 7 | ||||
-rw-r--r-- | lib/ansible/galaxy/role.py | 4 |
3 files changed, 8 insertions, 5 deletions
diff --git a/changelogs/fragments/dont_assume_role_versions.yml b/changelogs/fragments/dont_assume_role_versions.yml new file mode 100644 index 0000000000..f146f86882 --- /dev/null +++ b/changelogs/fragments/dont_assume_role_versions.yml @@ -0,0 +1,2 @@ +bugfixes: + - new code assumed role_versions always were present event though rest of code does not. diff --git a/lib/ansible/galaxy/api.py b/lib/ansible/galaxy/api.py index 55e46c44f7..d029821735 100644 --- a/lib/ansible/galaxy/api.py +++ b/lib/ansible/galaxy/api.py @@ -200,6 +200,7 @@ class GalaxyAPI(object): The url comes from the 'related' field of the role. """ + results = [] try: url = '%s/roles/%s/%s/?page_size=50' % (self.baseurl, role_id, related) data = self.__call_galaxy(url) @@ -210,9 +211,9 @@ class GalaxyAPI(object): data = self.__call_galaxy(url) results += data['results'] done = (data.get('next_link', None) is None) - return results - except Exception: - return None + except Exception as e: + display.vvvv("Unable to retrive role (id=%s) data (%s), but this is not fatal so we continue: %s" % (role_id, related, to_text(e))) + return results @g_connect def get_list(self, what): diff --git a/lib/ansible/galaxy/role.py b/lib/ansible/galaxy/role.py index a7ecdc08ce..2956655dd7 100644 --- a/lib/ansible/galaxy/role.py +++ b/lib/ansible/galaxy/role.py @@ -230,13 +230,13 @@ class GalaxyRole(object): '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]) + self.version = to_text(loose_versions[-1]) elif role_data.get('github_branch', None): self.version = role_data['github_branch'] else: self.version = 'master' elif self.version != 'master': - if role_versions and str(self.version) not in [a.get('name', None) for a in role_versions]: + if role_versions and to_text(self.version) not in [a.get('name', None) for a in role_versions]: raise AnsibleError("- the specified version (%s) of %s was not found in the list of available versions (%s)." % (self.version, self.name, role_versions)) |