Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix galaxy role info bug to support multiple roles #70148

Merged
merged 3 commits into from Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/70148-galaxy-role-info.yaml
@@ -0,0 +1,2 @@
bugfixes:
- Fixes ``ansible-galaxy role info`` to support multiple roles on the command line (https://github.com/ansible/ansible/pull/70148)
4 changes: 3 additions & 1 deletion lib/ansible/cli/galaxy.py
Expand Up @@ -653,6 +653,8 @@ def _display_role_info(role_info):
else:
text.append(u"\t%s: %s" % (k, role_info[k]))

# make sure we have a trailing newline returned
text.append(u"")
return u'\n'.join(text)

@staticmethod
Expand Down Expand Up @@ -970,7 +972,7 @@ def execute_info(self):
if role_spec:
role_info.update(role_spec)

data = self._display_role_info(role_info)
data += self._display_role_info(role_info)

self.pager(data)

Expand Down
7 changes: 7 additions & 0 deletions test/integration/targets/ansible-galaxy/runme.sh
Expand Up @@ -273,6 +273,13 @@ f_ansible_galaxy_status \
ansible-galaxy role info -p ./testroles --offline testdesc | tee out.txt
grep 'description: Top level' out.txt

# test multiple role listing
ansible-galaxy role init otherrole --init-path ./testroles
ansible-galaxy role info -p ./testroles --offline testdesc otherrole | tee out.txt
grep 'Role: testdesc' out.txt
grep 'Role: otherrole' out.txt


popd # ${role_testdir}
rm -fr "${role_testdir}"

Expand Down