Skip to content

Commit

Permalink
Fixes --version in ansible-galaxy cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaps authored and abadger committed Oct 17, 2019
1 parent 81d49c3 commit 202ad4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ansible/cli/galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class GalaxyCLI(CLI):

def __init__(self, args):
# Inject role into sys.argv[1] as a backwards compatibility step
if len(args) > 1 and args[1] not in ['-h', '--help'] and 'role' not in args and 'collection' not in args:
if len(args) > 1 and args[1] not in ['-h', '--help', '--version'] and 'role' not in args and 'collection' not in args:
# TODO: Should we add a warning here and eventually deprecate the implicit role subcommand choice
# Remove this in Ansible 2.13 when we also remove -v as an option on the root parser for ansible-galaxy.
idx = 2 if args[1].startswith('-v') else 1
Expand Down
3 changes: 3 additions & 0 deletions test/integration/targets/ansible-galaxy/runme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ ansible-playbook setup.yml "$@"

trap 'ansible-playbook cleanup.yml' EXIT

# Very simple version test
ansible-galaxy --version

# Need a relative custom roles path for testing various scenarios of -p
galaxy_relative_rolespath="my/custom/roles/path"

Expand Down

0 comments on commit 202ad4f

Please sign in to comment.