Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
don't fail if user already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
kervel committed Nov 20, 2021
1 parent 9845984 commit 71ad0cc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions charts/cvat-helm/templates/cvat-init-create-users.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ spec:
value: 'cvat-db'
command: ["/bin/sh", "-c"]
args:
- python3 ~/manage.py createsuperuser --username "{{ .Values.superUser.username }}" --email "{{ .Values.superUser.email }}" --noinput &&
echo "from django.contrib.auth.models import User; u=User.objects.get(username='{{ .Values.superUser.username }}'); u.set_password('{{ .Values.superUser.initialPassword }}'); u.save()" | python3 ~/manage.py shell
- |
cat <<EOF | python manage.py shell
from django.contrib.auth import get_user_model
User = get_user_model() # get the currently active user model,
User.objects.filter(username='{{ .Values.superUser.username }}').exists() or \
User.objects.create_superuser('{{ .Values.superUser.username }}', '{{ .Values.superUser.email }}', '{{ .Values.superUser.initialPassword }}')
EOF
{{ end }}

0 comments on commit 71ad0cc

Please sign in to comment.