Login error on hot standby instance using SESSION_FILE_PATH -- django tries to update last_login #2558

Closed
opened 2025-12-29 18:19:56 +01:00 by adam · 6 comments
Owner

Originally created by @kartiksubbarao on GitHub (Apr 27, 2019).

Environment

  • Python version: 3.5.2
  • NetBox version: 2.5.10

Steps to Reproduce

  1. Set up netbox on a remote system (master), and create a user account on that system

  2. Set up postgresql on localhost as a hot standby replica of the master system database (if necessary I could provide more detail here, but as you'll see below the error is django-related and doesn't involve postgresql)

  3. Set up netbox on localhost. In configuration.py, set SESSION_FILE_PATH to a writable directory. Here is an example configuration.py:

    # Add any additional hosts here as appropriate
    ALLOWED_HOSTS = [ 'localhost', '127.0.0.1' ]
    DATABASE = { 'NAME': 'netbox', 'USER': 'netbox' }
    SECRET_KEY = '[omitted]'
    SESSION_FILE_PATH = '/var/run/netbox'

  4. Reload apache (or whatever WSGI server you have configured)

  5. Try to login to netbox

Expected Behavior

I expected that logins would work successfully as indicated by #2426

Observed Behavior

Netbox creates the session files successfully in /var/run/netbox. But when I try to login, I get the following exception:

<class 'django.db.utils.InternalError'>

cannot execute UPDATE in a read-only transaction

The key line in the stack trace is this one:

File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/models.py", line 20, in update_last_login
user.save(update_fields=['last_login'])

It looks like django is trying to update the last_login field in the database, which leads to the read-only error. Another user has reported the same issue in this email thread where I first reported the issue: https://groups.google.com/d/msg/netbox-discuss/1tYF9d-wRl8/smnPiyWKAwAJ

I did some searching and came across this link:

https://stackoverflow.com/questions/49025407/in-django-1-11-how-to-allow-users-to-login-on-a-read-only-database

It refers to a python module called django-no-last-login which calls user_logged_in.disconnect(update_last_login) to disable the update:

https://github.com/MSA-Argentina/django-no-last-login/blob/master/nolastlogin/models.py#L11

Perhaps something like this might be needed to get this functionality working. Or perhaps I'm missing something. Is anyone able to get logins to read-only replicas to work properly?

Originally created by @kartiksubbarao on GitHub (Apr 27, 2019). ### Environment * Python version: 3.5.2 * NetBox version: 2.5.10 ### Steps to Reproduce 1. Set up netbox on a remote system (master), and create a user account on that system 2. Set up postgresql on localhost as a hot standby replica of the master system database (if necessary I could provide more detail here, but as you'll see below the error is django-related and doesn't involve postgresql) 3. Set up netbox on localhost. In configuration.py, set SESSION_FILE_PATH to a writable directory. Here is an example configuration.py: \# Add any additional hosts here as appropriate ALLOWED_HOSTS = [ 'localhost', '127.0.0.1' ] DATABASE = { 'NAME': 'netbox', 'USER': 'netbox' } SECRET_KEY = '[omitted]' SESSION_FILE_PATH = '/var/run/netbox' 4. Reload apache (or whatever WSGI server you have configured) 5. Try to login to netbox ### Expected Behavior I expected that logins would work successfully as indicated by #2426 ### Observed Behavior Netbox creates the session files successfully in /var/run/netbox. But when I try to login, I get the following exception: <class 'django.db.utils.InternalError'> cannot execute UPDATE in a read-only transaction The key line in the stack trace is this one: File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/models.py", line 20, in update_last_login user.save(update_fields=['last_login']) It looks like django is trying to update the ```last_login``` field in the database, which leads to the read-only error. Another user has reported the same issue in this email thread where I first reported the issue: https://groups.google.com/d/msg/netbox-discuss/1tYF9d-wRl8/smnPiyWKAwAJ I did some searching and came across this link: https://stackoverflow.com/questions/49025407/in-django-1-11-how-to-allow-users-to-login-on-a-read-only-database It refers to a python module called django-no-last-login which calls ```user_logged_in.disconnect(update_last_login)``` to disable the update: https://github.com/MSA-Argentina/django-no-last-login/blob/master/nolastlogin/models.py#L11 Perhaps something like this might be needed to get this functionality working. Or perhaps I'm missing something. Is anyone able to get logins to read-only replicas to work properly?
adam added the type: bugstatus: accepted labels 2025-12-29 18:19:56 +01:00
adam closed this issue 2025-12-29 18:19:56 +01:00
Author
Owner

@kartiksubbarao commented on GitHub (Apr 29, 2019):

@jeremystretch It looks like 3562b5552b fixes the problem if MAINTENANCE_MODE is set. But if SESSION_FILE_PATH is set and MAINTENANCE_MODE is not set -- which is the normal scenario for a hot-standby system -- the issue still seems to be present. Am I missing something?

@kartiksubbarao commented on GitHub (Apr 29, 2019): @jeremystretch It looks like https://github.com/digitalocean/netbox/commit/3562b5552bfdc22a52f43763696865ddab942b67 fixes the problem if MAINTENANCE_MODE is set. But if SESSION_FILE_PATH is set and MAINTENANCE_MODE is not set -- which is the normal scenario for a hot-standby system -- the issue still seems to be present. Am I missing something?
Author
Owner

@jeremystretch commented on GitHub (Apr 29, 2019):

MAINTENANCE_MODE is being leveraged to indicate that the database can not (or should not) be written to, since AFAICT this isn't indicated explicitly by the database connection. SESSION_FILE_PATH instructs NetBox to store session data in files rather than in the database but Django will still try to update the user's last_login time in the database without the fix I've applied.

@jeremystretch commented on GitHub (Apr 29, 2019): `MAINTENANCE_MODE` is being leveraged to indicate that the database can not (or should not) be written to, since AFAICT this isn't indicated explicitly by the database connection. `SESSION_FILE_PATH` instructs NetBox to store session data in files rather than in the database but Django will still try to update the user's `last_login` time in the database without the fix I've applied.
Author
Owner

@kartiksubbarao commented on GitHub (Apr 29, 2019):

Ok. I was assuming that if the user explicitly sets SESSION_FILE_PATH, then we can assume they don't care about storing the last login time in the database. (So you could call user_logged_in.disconnect() based on the existence of SESSION_FILE_PATH). But if you want to preserve the last_login functionality even with file-based sessions, I can see why you'd want to leverage a different field.

@kartiksubbarao commented on GitHub (Apr 29, 2019): Ok. I was assuming that if the user explicitly sets SESSION_FILE_PATH, then we can assume they don't care about storing the last login time in the database. (So you could call ```user_logged_in.disconnect()``` based on the existence of SESSION_FILE_PATH). But if you want to preserve the last_login functionality even with file-based sessions, I can see why you'd want to leverage a different field.
Author
Owner

@kartiksubbarao commented on GitHub (May 8, 2019):

@jeremystretch I tested this on 2.5.12 and unfortunately it still doesn't seem to work. There seems to be at least two other places in the code where it tries to save information associated with a user login to the database. I'll post the stack traces in the next two comments.

@kartiksubbarao commented on GitHub (May 8, 2019): @jeremystretch I tested this on 2.5.12 and unfortunately it still doesn't seem to work. There seems to be at least two other places in the code where it tries to save information associated with a user login to the database. I'll post the stack traces in the next two comments.
Author
Owner

@kartiksubbarao commented on GitHub (May 8, 2019):

Case #1: authenticating with a local DB password. The key line seems to be line 110 of /usr/local/lib/python3.5/dist-packages/django/contrib/auth/base_user.py. Reading the comments, it seems to be associated with a password hash upgrade. But I also tried logging into the master instance (to flush out any password hash changes) and then logging in again to the standby instance. But I still get the same error.

Internal Server Error: /login/
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.InternalError: cannot execute UPDATE in a read-only transaction


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.5/dist-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/django/utils/decorators.py", line 45, in _wrapper
    return bound_method(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
    return view(request, *args, **kwargs)
  File "/opt/netbox/netbox/users/views.py", line 32, in dispatch
    return super().dispatch(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/django/views/generic/base.py", line 97, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/netbox/netbox/users/views.py", line 43, in post
    if form.is_valid():
  File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 185, in is_valid
    return self.is_bound and not self.errors
  File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 180, in errors
    self.full_clean()
  File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 382, in full_clean
    self._clean_form()
  File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 409, in _clean_form
    cleaned_data = self.clean()
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/forms.py", line 196, in clean
    self.user_cache = authenticate(self.request, username=username, password=password)
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/__init__.py", line 73, in authenticate
    user = backend.authenticate(request, **credentials)
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/backends.py", line 26, in authenticate
    if user.check_password(password) and self.user_can_authenticate(user):
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/base_user.py", line 111, in check_password
    return check_password(raw_password, self.password, setter)
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/hashers.py", line 61, in check_password
    setter(password)
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/base_user.py", line 110, in setter
    self.save(update_fields=["password"])
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/base_user.py", line 66, in save
    super().save(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 741, in save
    force_update=force_update, update_fields=update_fields)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 779, in save_base
    force_update, using, update_fields,
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 851, in _save_table
    forced_update)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 900, in _do_update
    return filtered._update(values) > 0
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 760, in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1429, in execute_sql
    cursor = super().execute_sql(result_type)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1100, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.InternalError: cannot execute UPDATE in a read-only transaction
@kartiksubbarao commented on GitHub (May 8, 2019): Case #1: authenticating with a local DB password. The key line seems to be line 110 of /usr/local/lib/python3.5/dist-packages/django/contrib/auth/base_user.py. Reading the comments, it seems to be associated with a password hash upgrade. But I also tried logging into the master instance (to flush out any password hash changes) and then logging in again to the standby instance. But I still get the same error. ``` Internal Server Error: /login/ Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) psycopg2.InternalError: cannot execute UPDATE in a read-only transaction The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python3.5/dist-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/django/utils/decorators.py", line 45, in _wrapper return bound_method(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper return view(request, *args, **kwargs) File "/opt/netbox/netbox/users/views.py", line 32, in dispatch return super().dispatch(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/django/views/generic/base.py", line 97, in dispatch return handler(request, *args, **kwargs) File "/opt/netbox/netbox/users/views.py", line 43, in post if form.is_valid(): File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 185, in is_valid return self.is_bound and not self.errors File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 180, in errors self.full_clean() File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 382, in full_clean self._clean_form() File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 409, in _clean_form cleaned_data = self.clean() File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/forms.py", line 196, in clean self.user_cache = authenticate(self.request, username=username, password=password) File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/__init__.py", line 73, in authenticate user = backend.authenticate(request, **credentials) File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/backends.py", line 26, in authenticate if user.check_password(password) and self.user_can_authenticate(user): File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/base_user.py", line 111, in check_password return check_password(raw_password, self.password, setter) File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/hashers.py", line 61, in check_password setter(password) File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/base_user.py", line 110, in setter self.save(update_fields=["password"]) File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/base_user.py", line 66, in save super().save(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 741, in save force_update=force_update, update_fields=update_fields) File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 779, in save_base force_update, using, update_fields, File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 851, in _save_table forced_update) File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 900, in _do_update return filtered._update(values) > 0 File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 760, in _update return query.get_compiler(self.db).execute_sql(CURSOR) File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1429, in execute_sql cursor = super().execute_sql(result_type) File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1100, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers return executor(sql, params, many, context) File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 89, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) django.db.utils.InternalError: cannot execute UPDATE in a read-only transaction ```
Author
Owner

@kartiksubbarao commented on GitHub (May 8, 2019):

Case #2: authenticating with an LDAP password. The key line here seems to be line 612 of /usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py. It seems to think it needs to 'build' this user instead of just 'populating' it. Not sure what's going on here because I've already logged in as this user on the master instance several times. So whatever state it needs should have already been built in the database by now. Not sure why it wants to try to build state now on the standby instance.

Internal Server Error: /login/
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.InternalError: cannot execute UPDATE in a read-only transaction


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.5/dist-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/django/utils/decorators.py", line 45, in _wrapper
    return bound_method(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
    return view(request, *args, **kwargs)
  File "/opt/netbox/netbox/users/views.py", line 32, in dispatch
    return super().dispatch(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/django/views/generic/base.py", line 97, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/netbox/netbox/users/views.py", line 43, in post
    if form.is_valid():
  File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 185, in is_valid
    return self.is_bound and not self.errors
  File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 180, in errors
    self.full_clean()
  File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 382, in full_clean
    self._clean_form()
  File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 409, in _clean_form
    cleaned_data = self.clean()
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/forms.py", line 196, in clean
    self.user_cache = authenticate(self.request, username=username, password=password)
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/__init__.py", line 73, in authenticate
    user = backend.authenticate(request, **credentials)
  File "/usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py", line 150, in authenticate
    user = self.authenticate_ldap_user(ldap_user, password)
  File "/usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py", line 210, in authenticate_ldap_user
    return ldap_user.authenticate(password)
  File "/usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py", line 350, in authenticate
    self._get_or_create_user()
  File "/usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py", line 612, in _get_or_create_user
    self._user.save()
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/base_user.py", line 66, in save
    super().save(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 741, in save
    force_update=force_update, update_fields=update_fields)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 779, in save_base
    force_update, using, update_fields,
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 851, in _save_table
    forced_update)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 900, in _do_update
    return filtered._update(values) > 0
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 760, in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1429, in execute_sql
    cursor = super().execute_sql(result_type)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1100, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.InternalError: cannot execute UPDATE in a read-only transaction
@kartiksubbarao commented on GitHub (May 8, 2019): Case #2: authenticating with an LDAP password. The key line here seems to be line 612 of /usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py. It seems to think it needs to 'build' this user instead of just 'populating' it. Not sure what's going on here because I've already logged in as this user on the master instance several times. So whatever state it needs should have already been built in the database by now. Not sure why it wants to try to build state now on the standby instance. ``` Internal Server Error: /login/ Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) psycopg2.InternalError: cannot execute UPDATE in a read-only transaction The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python3.5/dist-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/django/utils/decorators.py", line 45, in _wrapper return bound_method(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper return view(request, *args, **kwargs) File "/opt/netbox/netbox/users/views.py", line 32, in dispatch return super().dispatch(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/django/views/generic/base.py", line 97, in dispatch return handler(request, *args, **kwargs) File "/opt/netbox/netbox/users/views.py", line 43, in post if form.is_valid(): File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 185, in is_valid return self.is_bound and not self.errors File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 180, in errors self.full_clean() File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 382, in full_clean self._clean_form() File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py", line 409, in _clean_form cleaned_data = self.clean() File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/forms.py", line 196, in clean self.user_cache = authenticate(self.request, username=username, password=password) File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/__init__.py", line 73, in authenticate user = backend.authenticate(request, **credentials) File "/usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py", line 150, in authenticate user = self.authenticate_ldap_user(ldap_user, password) File "/usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py", line 210, in authenticate_ldap_user return ldap_user.authenticate(password) File "/usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py", line 350, in authenticate self._get_or_create_user() File "/usr/local/lib/python3.5/dist-packages/django_auth_ldap/backend.py", line 612, in _get_or_create_user self._user.save() File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/base_user.py", line 66, in save super().save(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 741, in save force_update=force_update, update_fields=update_fields) File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 779, in save_base force_update, using, update_fields, File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 851, in _save_table forced_update) File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 900, in _do_update return filtered._update(values) > 0 File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 760, in _update return query.get_compiler(self.db).execute_sql(CURSOR) File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1429, in execute_sql cursor = super().execute_sql(result_type) File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1100, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers return executor(sql, params, many, context) File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 89, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) django.db.utils.InternalError: cannot execute UPDATE in a read-only transaction ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2558