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

Updating SoftwareVersion Throws Error On Null Platform #626

Open
jdrew82 opened this issue Dec 11, 2024 · 0 comments · May be fixed by #627
Open

Updating SoftwareVersion Throws Error On Null Platform #626

jdrew82 opened this issue Dec 11, 2024 · 0 comments · May be fixed by #627
Labels
integration: dna center Issues/PRs for Cisco DNA Center integration. type: bug Issues/PRs addressing a bug.

Comments

@jdrew82
Copy link
Contributor

jdrew82 commented Dec 11, 2024

Environment

  • Python version: 3.10
  • Nautobot version: 2.3.13
  • nautobot-ssot version: 3.3.0

Expected Behavior

I expect the ability to update SoftwareVersion on Devices without an error being thrown.

Observed Behavior

I observed an IntegrityError being thrown with the following traceback:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/celery/app/trace.py", line 477, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/celery/app/trace.py", line 760, in __protected_call__
    return self.run(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/nautobot/extras/jobs.py", line 1136, in run_job
    result = job(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/nautobot/extras/jobs.py", line 149, in __call__
    return self.run(*args, **deserialized_kwargs)
  File "/usr/local/lib/python3.10/site-packages/nautobot_ssot/integrations/dna_center/jobs.py", line 208, in run
    super().run(dryrun=self.dryrun, memory_profiling=self.memory_profiling, *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/nautobot_ssot/jobs/base.py", line 354, in run
    self.sync_data(memory_profiling)
  File "/usr/local/lib/python3.10/site-packages/nautobot_ssot/jobs/base.py", line 196, in sync_data
    self.execute_sync()
  File "/usr/local/lib/python3.10/site-packages/nautobot_ssot/jobs/base.py", line 98, in execute_sync
    self.source_adapter.sync_to(self.target_adapter, flags=self.diffsync_flags)
  File "/usr/local/lib/python3.10/site-packages/diffsync/__init__.py", line 626, in sync_to
    return target.sync_from(self, diff_class=diff_class, flags=flags, callback=callback, diff=diff)
  File "/usr/local/lib/python3.10/site-packages/diffsync/__init__.py", line 598, in sync_from
    result = syncer.perform_sync()
  File "/usr/local/lib/python3.10/site-packages/diffsync/helpers.py", line 329, in perform_sync
    changed |= self.sync_diff_element(element)
  File "/usr/local/lib/python3.10/site-packages/diffsync/helpers.py", line 379, in sync_diff_element
    changed, modified_model = self.sync_model(src_model=src_model, dst_model=dst_model, ids=ids, attrs=attrs)
  File "/usr/local/lib/python3.10/site-packages/diffsync/helpers.py", line 432, in sync_model
    dst_model = dst_model.update(attrs=attrs)
  File "/usr/local/lib/python3.10/site-packages/nautobot_ssot/integrations/dna_center/diffsync/models/nautobot.py", line 292, in update
    device.software_version = SoftwareVersion.objects.get_or_create(
  File "/usr/local/lib/python3.10/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 923, in get_or_create
    return self.create(**params), True
  File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 658, in create
    obj.save(force_insert=True, using=self.db)
  File "/usr/local/lib/python3.10/site-packages/django/db/models/base.py", line 814, in save
    self.save_base(
  File "/usr/local/lib/python3.10/site-packages/django/db/models/base.py", line 877, in save_base
    updated = self._save_table(
  File "/usr/local/lib/python3.10/site-packages/django/db/models/base.py", line 1020, in _save_table
    results = self._do_insert(
  File "/usr/local/lib/python3.10/site-packages/django/db/models/base.py", line 1061, in _do_insert
    return manager._insert(
  File "/usr/local/lib/python3.10/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 1805, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/usr/local/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1822, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 102, in execute
    return super().execute(sql, params)
  File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/usr/local/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/site-packages/django_prometheus/db/common.py", line 69, in execute
    return super().execute(*args, **kwargs)
django.db.utils.IntegrityError: null value in column "platform_id" of relation "dcim_softwareversion" violates not-null constraint
DETAIL:  Failing row contains (a2a37dfe-84b9-441a-badd-338e6e25dfcb, 2024-12-11 04:49:39.593844+00, 2024-12-11 04:49:39.593862+00, {}, 17.9.2.52, , null, null, , f, f, null, 56c61548-c7e9-4921-b409-bfc475af0722).

Steps to Reproduce

  1. Setup DNAC integration and load data in.
  2. Change software version on a Device and resync so the SoftwareVersion is updated on it.
  3. Review logs for error.
@jdrew82 jdrew82 added type: bug Issues/PRs addressing a bug. integration: dna center Issues/PRs for Cisco DNA Center integration. labels Dec 11, 2024
@jdrew82 jdrew82 linked a pull request Dec 11, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration: dna center Issues/PRs for Cisco DNA Center integration. type: bug Issues/PRs addressing a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant