From 29e37a31d77f55a2c0c9c29d9b5beca8bcf28cda Mon Sep 17 00:00:00 2001 From: Marc <980978+marchagen@users.noreply.github.com> Date: Wed, 15 Mar 2023 21:53:59 +0100 Subject: [PATCH] Catch DoesNotExist preventing startup Fixes failing startup because of python error: ``` Traceback (most recent call last): File "/opt/netbox/netbox/./manage.py", line 10, in execute_from_command_line(sys.argv) File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line utility.execute() File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 402, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute output = self.handle(*args, **options) File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/commands/shell.py", line 127, in handle exec(sys.stdin.read(), globals()) File "", line 2, in File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 650, in get raise self.model.DoesNotExist( users.models.Token.DoesNotExist: Token matching query does not exist. ``` --- docker/docker-entrypoint.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index c3fb321..9b39689 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -84,9 +84,12 @@ fi ./manage.py shell --interface python <