nautobot / nautobot-app-welcome-wizard

Magic and wonder UI wizard that simplifies getting started with Nautobot.
https://docs.nautobot.com/projects/welcome-wizard/en/latest/
Other
13 stars 7 forks source link

AttributeError when trying to import Manufacturers or DeviceTypes #98

Closed TheBirdsNest closed 10 months ago

TheBirdsNest commented 10 months ago

Environment

When clicking the 'Import' wizard hat icon, I expect manufacturers to be imported into the Nautobot Manufacturer model automatically without errors.

When clicking the 'Import' wizard hat icon, I expect Device Types to be imported into the Nautobot Device Type model automatically without errors.

Clicking either Import for Manufacturers, or Device Types results in an AttributeError: 'NoneType' object has not attribute 'pop'.

This happens consistently on a new installation(s) of Nautobot with just the Welcome Wizard plugin enabled.

21:19:45.982 INFO    django.server :
  "GET /plugins/welcome_wizard/manufacturers/import/ HTTP/1.1" 302 0
21:19:46.076 ERROR   django.request :
  Internal Server Error: /plugins/welcome_wizard/manufacturers/
Traceback (most recent call last):
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/core/views/mixins.py", line 168, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/nautobot/.local/lib/python3.11/site-packages/welcome_wizard/views.py", line 64, in get
    check_sync(instance=self, request=request)
  File "/opt/nautobot/.local/lib/python3.11/site-packages/welcome_wizard/views.py", line 48, in check_sync
    enqueue_pull_git_repository_and_refresh_data(repo, request.user)
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/datasources/git.py", line 77, in enqueue_pull_git_repository_and_refresh_data
    return enqueue_git_repository_helper(repository, user, GitRepositorySync)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/datasources/git.py", line 61, in enqueue_git_repository_helper
    return JobResult.enqueue_job(job_model, user, repository=repository.pk)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/models/jobs.py", line 673, in enqueue_job
    transaction.on_commit(
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/db/transaction.py", line 128, in on_commit
    get_connection(using).on_commit(func)
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 645, in on_commit
    func()
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/models/jobs.py", line 674, in <lambda>
    lambda: job_model.job_task.apply_async(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/task.py", line 594, in apply_async
    return app.send_task(
           ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/base.py", line 736, in send_task
    options = router.route(
              ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/routes.py", line 74, in route
    options = lpmerge(self.expand_destination(
                      ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/routes.py", line 85, in expand_destination
    queue = route.pop('queue', None)
            ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'pop'
21:19:46.082 ERROR   django.server :
  "GET /plugins/welcome_wizard/manufacturers/ HTTP/1.1" 500 187089
21:19:49.371 INFO    django.server :
  "GET /plugins/welcome_wizard/manufacturers/import/ HTTP/1.1" 302 0
21:19:49.457 ERROR   django.request :
  Internal Server Error: /plugins/welcome_wizard/manufacturers/
Traceback (most recent call last):
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/core/views/mixins.py", line 168, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/nautobot/.local/lib/python3.11/site-packages/welcome_wizard/views.py", line 64, in get
    check_sync(instance=self, request=request)
  File "/opt/nautobot/.local/lib/python3.11/site-packages/welcome_wizard/views.py", line 48, in check_sync
    enqueue_pull_git_repository_and_refresh_data(repo, request.user)
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/datasources/git.py", line 77, in enqueue_pull_git_repository_and_refresh_data
    return enqueue_git_repository_helper(repository, user, GitRepositorySync)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/datasources/git.py", line 61, in enqueue_git_repository_helper
    return JobResult.enqueue_job(job_model, user, repository=repository.pk)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/models/jobs.py", line 673, in enqueue_job
    transaction.on_commit(
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/db/transaction.py", line 128, in on_commit
    get_connection(using).on_commit(func)
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 645, in on_commit
    func()
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/models/jobs.py", line 674, in <lambda>
    lambda: job_model.job_task.apply_async(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/task.py", line 594, in apply_async
    return app.send_task(
           ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/base.py", line 736, in send_task
    options = router.route(
              ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/routes.py", line 74, in route
    options = lpmerge(self.expand_destination(
                      ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/routes.py", line 85, in expand_destination
    queue = route.pop('queue', None)
            ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'pop'
21:19:49.461 ERROR   django.server :
  "GET /plugins/welcome_wizard/manufacturers/ HTTP/1.1" 500 186903
21:19:53.201 INFO    django.server :
  "GET /plugins/welcome_wizard/manufacturers/import/ HTTP/1.1" 302 0
21:19:53.326 ERROR   django.request :
  Internal Server Error: /plugins/welcome_wizard/manufacturers/
Traceback (most recent call last):
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/core/views/mixins.py", line 168, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/nautobot/.local/lib/python3.11/site-packages/welcome_wizard/views.py", line 64, in get
    check_sync(instance=self, request=request)
  File "/opt/nautobot/.local/lib/python3.11/site-packages/welcome_wizard/views.py", line 48, in check_sync
    enqueue_pull_git_repository_and_refresh_data(repo, request.user)
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/datasources/git.py", line 77, in enqueue_pull_git_repository_and_refresh_data
    return enqueue_git_repository_helper(repository, user, GitRepositorySync)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/datasources/git.py", line 61, in enqueue_git_repository_helper
    return JobResult.enqueue_job(job_model, user, repository=repository.pk)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/models/jobs.py", line 673, in enqueue_job
    transaction.on_commit(
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/db/transaction.py", line 128, in on_commit
    get_connection(using).on_commit(func)
  File "/opt/nautobot/.local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 645, in on_commit
    func()
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/models/jobs.py", line 674, in <lambda>
    lambda: job_model.job_task.apply_async(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/task.py", line 594, in apply_async
    return app.send_task(
           ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/base.py", line 736, in send_task
    options = router.route(
              ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/routes.py", line 74, in route
    options = lpmerge(self.expand_destination(
                      ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/routes.py", line 85, in expand_destination
    queue = route.pop('queue', None)
            ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'pop'
21:19:53.331 ERROR   django.server :
  "GET /plugins/welcome_wizard/manufacturers/ HTTP/1.1" 500 186952

Steps to Reproduce (followed from installation guide: https://docs.nautobot.com/projects/welcome-wizard/en/latest/admin/install/)

  1. Install the additional Python package pip install nautobot-welcome-wizard
  2. Configure Nautobot Welcome Wizard:
# PLUGIN Configuration                     

PLUGINS = ['welcome_wizard']                                           

PLUGINS_CONFIG = {                                 
    'welcome_wizard': {                                             
        'enable_device_type_library': True,                         
        'enable_welcome_banner': False,                                       
    }                                                         
}  
  1. Run Post Upgrade nautobot-server post_upgrade
app $ nautobot-server post_upgrade
21:09:52.349 DEBUG   nautobot.core.celery __init__.py        import_jobs_as_celery_tasks() :
  Importing system Jobs
21:09:52.353 DEBUG   nautobot.core.celery __init__.py                      register_jobs() :
  Registering job nautobot.core.jobs.ExportObjectList
21:09:52.357 DEBUG   nautobot.core.celery __init__.py                      register_jobs() :
  Registering job nautobot.core.jobs.GitRepositorySync
21:09:52.357 DEBUG   nautobot.core.celery __init__.py                      register_jobs() :
  Registering job nautobot.core.jobs.GitRepositoryDryRun
21:09:53.069 DEBUG   nautobot.core.celery __init__.py                      register_jobs() :
  Registering job welcome_wizard.jobs.WelcomeWizardImportManufacturer
21:09:53.069 DEBUG   nautobot.core.celery __init__.py                      register_jobs() :
  Registering job welcome_wizard.jobs.WelcomeWizardImportDeviceType
Performing database migrations...
Operations to perform:
  Apply all migrations: admin, auth, circuits, contenttypes, database, dcim, django_celery_beat, django_celery_results, extras, ipam, sessions, social_django, taggit, tenancy, users, virtualization, welcome_wizard
Running migrations:
  Applying welcome_wizard.0001_initial... OK
  Applying welcome_wizard.0002_merlin_nautobot_list_link... OK
  Applying welcome_wizard.0003_auto_20210705_1912... OK
  Applying welcome_wizard.0004_remove_manufacturerimport_slug... OK
21:09:54.163 DEBUG   nautobot.core.celery __init__.py        import_jobs_as_celery_tasks() :
  Importing system Jobs
21:09:54.173 INFO    nautobot.extras.utils utils.py        refresh_job_model_from_job_class() :
  Refreshed Job "System Jobs: Export Object List" from <ExportObjectList>
21:09:54.181 INFO    nautobot.extras.utils utils.py        refresh_job_model_from_job_class() :
  Refreshed Job "System Jobs: Git Repository: Sync" from <GitRepositorySync>
21:09:54.189 INFO    nautobot.extras.utils utils.py        refresh_job_model_from_job_class() :
  Refreshed Job "System Jobs: Git Repository: Dry-Run" from <GitRepositoryDryRun>
21:09:54.200 INFO    nautobot.extras.utils utils.py        refresh_job_model_from_job_class() :
  Created Job "Welcome Wizard: Welcome Wizard - Import Manufacturer" from <WelcomeWizardImportManufacturer>
21:09:54.209 INFO    nautobot.extras.utils utils.py        refresh_job_model_from_job_class() :
  Created Job "Welcome Wizard: Welcome Wizard - Import Device Type" from <WelcomeWizardImportDeviceType>

Generating cable paths...
Found no missing circuit termination paths; skipping
Found no missing console port paths; skipping
Found no missing console server port paths; skipping
Found no missing interface paths; skipping
Found no missing power feed paths; skipping
Found no missing power outlet paths; skipping
Found no missing power port paths; skipping
Finished.

Collecting static files...

0 static files copied to '/opt/nautobot/static', 986 unmodified.

Removing stale content types...

Removing expired sessions...

Sending installation metrics...
Installation metrics are disabled by INSTALLATION_METRICS_ENABLED setting, skipping.

Refreshing _content_type cache
Refreshing content type cache

Refreshing dynamic group member caches...
DYNAMIC_GROUPS_MEMBER_CACHE_TIMEOUT is set to 0; skipping cache refresh
  1. Start Nautobot