make --help work properly for custom commands

see: https://github.com/ansible/awx/issues/4559
This commit is contained in:
Ryan Petrello
2019-08-26 12:18:10 -04:00
parent e19035079e
commit 6999d779a8
2 changed files with 14 additions and 2 deletions

View File

@@ -152,6 +152,9 @@ class CLI(object):
# control resources are special endpoints that you can only
# do an HTTP GET to, and which return plain JSON metadata
# examples are `/api/v2/ping/`, `/api/v2/config/`, etc...
if self.help:
self.subparsers[self.resource].print_help()
raise SystemExit()
self.method = 'get'
response = getattr(resource, self.method)()
else: