Fix role list regression (#67436)

Add the roles_path parent to the role_parser
object, so paths are passed to the list function

Add basic role list tests to prevent future regressions
This commit is contained in:
Sam Doran 2020-02-14 19:51:48 -05:00 committed by GitHub
parent 5ea26b6e5a
commit 7ae34cef15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ansible-galaxy - fix regression that prenented roles from being listed

View file

@ -176,7 +176,7 @@ class GalaxyCLI(CLI):
self.add_init_options(role_parser, parents=[common, force, offline]) self.add_init_options(role_parser, parents=[common, force, offline])
self.add_remove_options(role_parser, parents=[common, roles_path]) self.add_remove_options(role_parser, parents=[common, roles_path])
self.add_delete_options(role_parser, parents=[common, github]) self.add_delete_options(role_parser, parents=[common, github])
self.add_list_options(role_parser, parents=[common]) self.add_list_options(role_parser, parents=[common, roles_path])
self.add_search_options(role_parser, parents=[common]) self.add_search_options(role_parser, parents=[common])
self.add_import_options(role_parser, parents=[common, github]) self.add_import_options(role_parser, parents=[common, github])
self.add_setup_options(role_parser, parents=[common, roles_path]) self.add_setup_options(role_parser, parents=[common, roles_path])

View file

@ -107,6 +107,20 @@ EOF
popd # ${galaxy_testdir} popd # ${galaxy_testdir}
rm -fr "${galaxy_testdir}" rm -fr "${galaxy_testdir}"
# Galaxy role list test case
#
# Basic tests to ensure listing roles works
f_ansible_galaxy_status \
"role list"
ansible-galaxy role list | tee out.txt
ansible-galaxy role list test-role | tee -a out.txt
[[ $(grep -c '^- test-role' out.txt ) -eq 2 ]]
################################# #################################
# ansible-galaxy collection tests # ansible-galaxy collection tests
################################# #################################