nautobot / nautobot-app-version-control

Version Control App that uses and requires a Dolt Database
Other
30 stars 6 forks source link

Cannot switch Version Control from a non-main branch to main branch when Nautobot 1.2b is running #152

Closed tim-fiola closed 2 years ago

tim-fiola commented 2 years ago

When attempting to activate the main branch, a server error appears:

image

Here is a stack trace

16:44:44.355 ERROR   django.request :
  Internal Server Error: /plugins/dolt/branches/main/checkout/
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.9/site-packages/django/utils/deprecation.py", line 116, in __call__
    response = self.process_response(request, response)
  File "/usr/local/lib/python3.9/site-packages/django/contrib/sessions/middleware.py", line 63, in process_response
    request.session.save()
  File "/usr/local/lib/python3.9/site-packages/django/contrib/sessions/backends/db.py", line 84, in save
    using = router.db_for_write(self.model, instance=obj)
  File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 270, in _route_db
    chosen_db = method(model, **hints)
  File "/usr/local/lib/python3.9/site-packages/dolt/routers.py", line 49, in db_for_write
    raise DoltError(
dolt.utils.DoltError: Error writing model <strong>Session</strong>
                        on branch <strong>"test-branch"</strong>:
                        non-versioned models must be written on branch
                        <strong>"main"</strong>.

I am able to replicate this in one of our internal demo environments, but not when I run Version Control on Nautobot 1.2b in my local dev environment.

To recreate:

glennmatthews commented 2 years ago

I don't see this issue with a local development environment.

tim-fiola commented 2 years ago

fixed in https://github.com/networktocode-llc/gizmo-dolt-nautobot/pull/9