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

add the role version number to the ansible-galaxy error/warning message #70136

Closed
Closed
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
@@ -0,0 +1,2 @@
minor_changes:
- ansible-galaxy - add the role version to the ansible-galaxy error/warning message
4 changes: 2 additions & 2 deletions lib/ansible/cli/galaxy.py
Expand Up @@ -1122,7 +1122,7 @@ def _execute_install_role(self, requirements):
try:
installed = role.install()
except AnsibleError as e:
display.warning(u"- %s was NOT installed successfully: %s " % (role.name, to_text(e)))
display.warning(u"- %s %s was NOT installed successfully: %s " % (role.name, role.version or '*', to_text(e)))
self.exit_without_ignore()
continue

Expand Down Expand Up @@ -1164,7 +1164,7 @@ def _execute_install_role(self, requirements):
display.display('- dependency %s is already installed, skipping.' % dep_role.name)

if not installed:
display.warning("- %s was NOT installed successfully." % role.name)
display.warning("- %s %s was NOT installed successfully." % (role.name, role.version or '*'))
self.exit_without_ignore()

return 0
Expand Down
20 changes: 20 additions & 0 deletions test/integration/targets/ansible-galaxy/runme.sh
Expand Up @@ -184,6 +184,26 @@ popd # ${galaxy_testdir}
rm -fr "${galaxy_testdir}"


# Galaxy install test case
#
# Ensure that proper error message is thrown for non-existent role
#

f_ansible_galaxy_status \
"install a non-existant role"

galaxy_testdir=$(mktemp -d)
pushd "${galaxy_testdir}"

ansible-galaxy install notaroll,1.0 --ignore-errors | tee out.txt

# Test that the proper error/warning message was thrown
[[ $(grep -c '^- notaroll 1.0 was NOT installed successfully' out.txt ) -eq 0 ]]

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


# Galaxy role list tests
#
# Basic tests to ensure listing roles works
Expand Down