Commit cce36b66 authored by Samuel GAIST's avatar Samuel GAIST

[utils][commands][install] Add option to do only asset installation

This will avoid nuking the content of a live system
with the default values for queues, environments, etc.
parent 436b5a42
Pipeline #47842 passed with stage
in 16 minutes and 55 seconds
......@@ -170,6 +170,16 @@ def create_users(username, passwd):
return system_user, plot_user, user
def get_users(username):
from django.contrib.auth.models import User
system_user = User.objects.get(username=settings.SYSTEM_ACCOUNT)
plot_user = User.objects.get(username=settings.PLOT_ACCOUNT)
user = User.objects.get(username=username)
return system_user, plot_user, user
def list_objects(prefix, project, category, fnfilter):
"""Lists all objects matching a certain filter"""
......@@ -1236,6 +1246,14 @@ class Command(BaseCommand):
"that uses them, protocol templates before databases, etc.",
)
parser.add_argument(
"--assets-only",
action="store_true",
dest="assets_only",
default=False,
help="Only operate the asset installation part",
)
def handle(self, *ignored, **arguments):
# Setup this command's logging level
......@@ -1282,18 +1300,23 @@ class Command(BaseCommand):
call_command("migrate", interactive=False, verbosity=1)
# Setup sites: 1.Development; 2.Staging; 3.Production
create_sites()
if not arguments["assets_only"]:
# Setup sites: 1.Development; 2.Staging; 3.Production
create_sites()
system_user, plot_user, user = create_users(
arguments["username"], arguments["password"]
)
system_user, plot_user, user = create_users(
arguments["username"], arguments["password"]
)
# Sets up initial groups
add_group("Default")
# Sets up initial groups
add_group("Default")
# Sets up the queue and environments
setup_environment(arguments["queue_configuration"], arguments["verbosity"])
else:
system_user, plot_user, user = get_users(arguments["username"])
# Sets up the queue and environments
setup_environment(arguments["queue_configuration"], arguments["verbosity"])
from ....backend.models import EnvironmentLanguage
from ....code.models import Code
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment