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

Fix BulkAdd (Json + CSV) #118

Merged
merged 3 commits into from
Nov 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion nautobot_device_onboarding/worker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Worker code for processing inbound OnboardingTasks."""
import logging

from django.db import transaction
from django.core.exceptions import ValidationError

from prometheus_client import Summary

from nautobot.dcim.models import Device
Expand Down Expand Up @@ -132,7 +134,10 @@ def onboard_device(task_id, credentials): # pylint: disable=too-many-statements
def enqueue_onboarding_task(task_id, credentials):
"""Detect worker type and enqueue task."""
if CELERY_WORKER:
onboard_device_worker.delay(task_id, credentials.nautobot_serialize()) # pylint: disable=no-member
# on commit
transaction.on_commit(
lambda: onboard_device_worker.delay(task_id, credentials.nautobot_serialize()) # pylint: disable=no-member
)

if not CELERY_WORKER:
get_queue("default").enqueue( # pylint: disable=used-before-assignment
Expand Down
Loading