Block createsuperuser cmdline from creating additional accounts, since this will not create correct in-game account typeclasses. Resolve #2626.
This commit is contained in:
parent
61d611becf
commit
8ee3702efd
1 changed files with 34 additions and 19 deletions
|
|
@ -11,23 +11,23 @@ Run the script with the -h flag to see usage information.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import re
|
|
||||||
import signal
|
|
||||||
import shutil
|
|
||||||
import importlib
|
|
||||||
import pickle
|
|
||||||
from distutils.version import LooseVersion
|
|
||||||
from argparse import ArgumentParser
|
|
||||||
import argparse
|
import argparse
|
||||||
from subprocess import Popen, check_output, call, CalledProcessError, STDOUT
|
import importlib
|
||||||
|
import os
|
||||||
|
import pickle
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
import signal
|
||||||
|
import sys
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
from distutils.version import LooseVersion
|
||||||
|
from subprocess import STDOUT, CalledProcessError, Popen, call, check_output
|
||||||
|
|
||||||
from twisted.protocols import amp
|
|
||||||
from twisted.internet import reactor, endpoints
|
|
||||||
import django
|
import django
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
from django.db.utils import ProgrammingError
|
from django.db.utils import ProgrammingError
|
||||||
|
from twisted.internet import endpoints, reactor
|
||||||
|
from twisted.protocols import amp
|
||||||
|
|
||||||
# Signal processing
|
# Signal processing
|
||||||
SIG = signal.SIGINT
|
SIG = signal.SIGINT
|
||||||
|
|
@ -1147,8 +1147,9 @@ def tail_log_files(filename1, filename2, start_lines1=20, start_lines2=20, rate=
|
||||||
if new_linecount < old_linecount:
|
if new_linecount < old_linecount:
|
||||||
# this happens if the file was cycled or manually deleted/edited.
|
# this happens if the file was cycled or manually deleted/edited.
|
||||||
print(
|
print(
|
||||||
" ** Log file {filename} has cycled or been edited. "
|
" ** Log file {filename} has cycled or been edited. Restarting log. ".format(
|
||||||
"Restarting log. ".format(filename=filehandle.name)
|
filename=filehandle.name
|
||||||
|
)
|
||||||
)
|
)
|
||||||
new_linecount = 0
|
new_linecount = 0
|
||||||
old_linecount = 0
|
old_linecount = 0
|
||||||
|
|
@ -1614,8 +1615,9 @@ def kill(pidfile, component="Server", callback=None, errback=None, killsignal=SI
|
||||||
errback()
|
errback()
|
||||||
else:
|
else:
|
||||||
print(
|
print(
|
||||||
"Could not send kill signal - {component} does "
|
"Could not send kill signal - {component} does not appear to be running.".format(
|
||||||
"not appear to be running.".format(component=component)
|
component=component
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1631,6 +1633,7 @@ def show_version_info(about=False):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import twisted
|
import twisted
|
||||||
|
|
||||||
return VERSION_INFO.format(
|
return VERSION_INFO.format(
|
||||||
|
|
@ -1894,6 +1897,7 @@ def list_settings(keys):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
|
|
||||||
from evennia.utils import evtable
|
from evennia.utils import evtable
|
||||||
|
|
||||||
evsettings = import_module(SETTINGS_DOTPATH)
|
evsettings = import_module(SETTINGS_DOTPATH)
|
||||||
|
|
@ -1938,9 +1942,10 @@ def run_custom_commands(option, *args):
|
||||||
evennia mycmd foo bar
|
evennia mycmd foo bar
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.conf import settings
|
|
||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# a dict of {option: callable(*args), ...}
|
# a dict of {option: callable(*args), ...}
|
||||||
custom_commands = settings.EXTRA_LAUNCHER_COMMANDS
|
custom_commands = settings.EXTRA_LAUNCHER_COMMANDS
|
||||||
|
|
@ -2078,7 +2083,7 @@ def main():
|
||||||
action="store",
|
action="store",
|
||||||
dest="listsetting",
|
dest="listsetting",
|
||||||
metavar="all|<key>",
|
metavar="all|<key>",
|
||||||
help=("list settings, use 'all' to list all available keys"),
|
help="list settings, use 'all' to list all available keys",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--settings",
|
"--settings",
|
||||||
|
|
@ -2104,7 +2109,9 @@ def main():
|
||||||
action="store_true",
|
action="store_true",
|
||||||
dest="initmissing",
|
dest="initmissing",
|
||||||
default=False,
|
default=False,
|
||||||
help="checks for missing secret_settings or server logs\n directory, and adds them if needed",
|
help=(
|
||||||
|
"checks for missing secret_settings or server logs\n directory, and adds them if needed"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--profiler",
|
"--profiler",
|
||||||
|
|
@ -2340,6 +2347,14 @@ def main():
|
||||||
django.core.management.call_command(*([option] + unknown_args))
|
django.core.management.call_command(*([option] + unknown_args))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
if option in ("createsuperuser",):
|
||||||
|
print(
|
||||||
|
"Note: Don't create an additional superuser this way. It will not be set up "
|
||||||
|
"correctly.\n Instead, use the web admin or the in-game `py` command to "
|
||||||
|
"set `is_superuser=True` on a existing Account."
|
||||||
|
)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
if run_custom_commands(option, *unknown_args):
|
if run_custom_commands(option, *unknown_args):
|
||||||
# run any custom commands
|
# run any custom commands
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue