Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting KeyError: 'id' Error when importing Data to Nautobot #188

Open
Francisco-Pozo-Alight opened this issue Oct 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Francisco-Pozo-Alight
Copy link

Environment

  • Python version: 3.9
  • Nautobot version: <2.0.6
  • nautobot-netbox-importer version: 2.0.0

Hi, I'm getting the below error when trying to import the DB into Nautobot:

(nautobot-docker-compose-py3.10) root@dockerNautobot:/home/adminNOC/nautobot-docker-compose# invoke migratenetbox
Running docker compose command "ps --services --filter status=running"
Running docker compose command "exec nautobot nautobot-server import_netbox --bypass-data-validation --print-summary /var/tmp/netbox_data.json "
11:43:58.503 DEBUG nautobot.core.celery init.py import_jobs_as_celery_tasks() :
Importing system Jobs
11:43:58.519 DEBUG nautobot.core.celery init.py register_jobs() :
Registering job nautobot.core.jobs.GitRepositorySync
11:43:58.527 DEBUG nautobot.core.celery init.py register_jobs() :
Registering job nautobot.core.jobs.GitRepositoryDryRun
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
Running migrations:
No migrations to apply.
11:44:03.624 DEBUG nautobot.core.celery init.py import_jobs_as_celery_tasks() :
Importing system Jobs
11:44:03.639 INFO nautobot.extras.utils utils.py refresh_job_model_from_job_class() :
Refreshed Job "System Jobs: Git Repository: Sync" from
11:44:03.647 INFO nautobot.extras.utils utils.py refresh_job_model_from_job_class() :
Refreshed Job "System Jobs: Git Repository: Dry-Run" from
ImporterIssue(uid='81585c73-2aff-517d-b4c9-9e39471a1e50', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Europe/Amsterdam, replaced with None'}")
ImporterIssue(uid='1923bc1a-c852-5d8f-bad2-fb22c990bbe8', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Europe/Amsterdam, replaced with None'}")
ImporterIssue(uid='daa8285b-7879-5cda-9a05-9117f17aebf3', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Europe/Brussels, replaced with None'}")
ImporterIssue(uid='41a1e353-2682-5fb3-abb8-79a41a32ffb7', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Europe/Brussels, replaced with None'}")
ImporterIssue(uid='be564edf-c79a-5425-b74d-c8458e6c8c1f', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: America/New_York, replaced with None'}")
ImporterIssue(uid='3cd492ba-a6ee-5ea1-98d4-ec6aad817ac0', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: America/New_York, replaced with None'}")
ImporterIssue(uid='9d01b433-2e92-5004-ae45-9df374cc6258', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Europe/Brussels, replaced with None'}")
ImporterIssue(uid='dcc032b3-de14-5b82-8f22-f20d5bc6a295', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Europe/Brussels, replaced with None'}")
ImporterIssue(uid='4f70a582-e0b8-5d1c-b5e3-3f98676d5735', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Europe/Brussels, replaced with None'}")
ImporterIssue(uid='1a9481e0-2e60-52b6-825b-b968dde03206', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Asia/Kuala_Lumpur, replaced with None'}")
ImporterIssue(uid='a3673883-9c49-50ac-9751-204dd0544afa', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Asia/Dubai, replaced with None'}")
ImporterIssue(uid='04e04a6f-dddc-5b6e-995b-211594abd127', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Europe/Brussels, replaced with None'}")
ImporterIssue(uid='125bfce4-235b-53ed-afed-091003c1217d', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Europe/Paris, replaced with None'}")
ImporterIssue(uid='c6a333b5-c6b0-5413-bf2f-f1463018854a', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Europe/Rome, replaced with None'}")
ImporterIssue(uid='5c4104a3-ed44-509a-9bb2-d35de14e054c', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: US/Central, replaced with None'}")
ImporterIssue(uid='2c233c32-1974-59b2-9309-8794b515d619', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Europe/Paris, replaced with None'}")
ImporterIssue(uid='214dfec9-6967-5c7f-93ed-15b6f5c41885', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Europe/Madrid, replaced with None'}")
ImporterIssue(uid='e9c3966d-4214-5003-a725-1473cfcfda1e', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: Europe/Madrid, replaced with None'}")
ImporterIssue(uid='a93067fc-2a29-51c5-aa41-c1a91145079b', name='', issue_type='InvalidChoiceValueIssue', message="{'time_zone': 'Invalid choice value: America/Denver, replaced with None'}")
Traceback (most recent call last):
File "/usr/local/bin/nautobot-server", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/nautobot/core/cli/init.py", line 53, in main
run_app(
File "/usr/local/lib/python3.9/site-packages/nautobot/core/runner/runner.py", line 297, in run_app
management.execute_from_command_line([runner_name, command] + command_args)
File "/usr/local/lib/python3.9/site-packages/django/core/management/init.py", line 419, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.9/site-packages/django/core/management/init.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.9/site-packages/nautobot_netbox_importer/management/commands/import_netbox.py", line 89, in handle
adapter.import_to_nautobot()
File "/usr/local/lib/python3.9/site-packages/nautobot_netbox_importer/diffsync/adapters/netbox.py", line 97, in import_to_nautobot
self._atomic_import()
File "/usr/local/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/usr/local/lib/python3.9/site-packages/nautobot_netbox_importer/diffsync/adapters/netbox.py", line 114, in _atomic_import
self.load()
File "/usr/local/lib/python3.9/site-packages/nautobot_netbox_importer/diffsync/adapters/netbox.py", line 86, in load
self.import_data()
File "/usr/local/lib/python3.9/site-packages/nautobot_netbox_importer/generator/source.py", line 333, in import_data
self.wrappers[content_type].second_pass(data)
File "/usr/local/lib/python3.9/site-packages/nautobot_netbox_importer/generator/source.py", line 479, in second_pass
self.import_record(data)
File "/usr/local/lib/python3.9/site-packages/nautobot_netbox_importer/generator/source.py", line 638, in import_record
uid = self.get_pk_from_data(data)
File "/usr/local/lib/python3.9/site-packages/nautobot_netbox_importer/generator/source.py", line 616, in get_pk_from_data
return self.get_pk_from_uid(data[self.nautobot.pk_field.name])
KeyError: 'id'

Any help to fix it would be really appreciated.

@gsnider2195 gsnider2195 added the bug Something isn't working label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants