mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
Nicer error on bad arguments to user_info.
This commit is contained in:
parent
1e1ea4e9ee
commit
4e5ebac6a0
@ -11,10 +11,18 @@ class Command(BaseCommand):
|
||||
"""A command that reports whether a username exists within the
|
||||
system or not.
|
||||
"""
|
||||
def handle(self, username, **options):
|
||||
def handle(self, *args, **options):
|
||||
"""Print out information about the user to the console."""
|
||||
|
||||
# Sanity check: There should be one and exactly one positional
|
||||
# argument.
|
||||
if len(args) != 1:
|
||||
raise CommandError('This command requires one positional argument '
|
||||
'(a username).')
|
||||
|
||||
# Get the user.
|
||||
try:
|
||||
username = args[0]
|
||||
user = User.objects.get(username=username)
|
||||
|
||||
# Print a cute header.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user