ansible-galaxy - more fixes for verbosity without sub type (#60604)

* ansible-galaxy - more fixes for verbosity without sub type

* remove testing line
pull/60626/head
Jordan Borean 5 years ago committed by GitHub
parent 25b20adb94
commit 4ebac7d5b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -44,7 +44,9 @@ class GalaxyCLI(CLI):
# 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:
# TODO: Should we add a warning here and eventually deprecate the implicit role subcommand choice
args.insert(1, 'role')
# 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
args.insert(idx, 'role')
self.api = None
self.galaxy = None

@ -469,6 +469,8 @@ class TestGalaxyInitSkeleton(unittest.TestCase, ValidRoleTests):
# deprecated and tests should be removed when the code that handles it is removed
(['ansible-galaxy', '-vv', 'collection', 'init', 'abc.def', '-v'], 1),
(['ansible-galaxy', '-vv', 'collection', 'init', 'abc.def', '-vvvv'], 4),
(['ansible-galaxy', '-vvv', 'init', 'name'], 3),
(['ansible-galaxy', '-vvvvv', 'init', '-v', 'name'], 1),
])
def test_verbosity_arguments(cli_args, expected, monkeypatch):
# Mock out the functions so we don't actually execute anything

Loading…
Cancel
Save