mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
Do not require an admin password on upgrade.
This commit makes us only require an admin password if there is a new admin user.
This commit is contained in:
22
awx/main/management/commands/user_exists.py
Normal file
22
awx/main/management/commands/user_exists.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Copyright (c) 2014 Ansible, Inc.
|
||||||
|
# All Rights Reserved
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
"""A command that reports whether a username exists within the
|
||||||
|
system or not.
|
||||||
|
"""
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
any_not_found = False
|
||||||
|
|
||||||
|
for username in args:
|
||||||
|
if User.objects.filter(username=username).count():
|
||||||
|
print('User %s exists.' % username)
|
||||||
|
else:
|
||||||
|
print('User %s does not exist.' % username)
|
||||||
|
any_not_found = True
|
||||||
Reference in New Issue
Block a user