From 1bc41631a8db7b691ed93012228ffc9d0084ba5a Mon Sep 17 00:00:00 2001 From: Allen Hogan <98360253+alhogan@users.noreply.github.com> Date: Thu, 15 Feb 2024 09:06:16 -0600 Subject: [PATCH] added decorator to close threaded db connections (#714) --- nautobot_golden_config/nornir_plays/config_deployment.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nautobot_golden_config/nornir_plays/config_deployment.py b/nautobot_golden_config/nornir_plays/config_deployment.py index f75c380f..a6845a2a 100644 --- a/nautobot_golden_config/nornir_plays/config_deployment.py +++ b/nautobot_golden_config/nornir_plays/config_deployment.py @@ -1,4 +1,5 @@ """Nornir job for deploying configurations.""" + from datetime import datetime from nautobot.dcim.models import Device @@ -13,11 +14,13 @@ from nornir_nautobot.plugins.tasks.dispatcher import dispatcher from nornir_nautobot.utils.logger import NornirLogger +from nautobot_golden_config.utilities.db_management import close_threaded_db_connections from nautobot_golden_config.nornir_plays.processor import ProcessGoldenConfig InventoryPluginRegister.register("nautobot-inventory", NautobotORMInventory) +@close_threaded_db_connections def run_deployment(task: Task, logger: NornirLogger, commit: bool, config_plan_qs, deploy_job_result) -> Result: """Deploy configurations to device.""" obj = task.host.data["obj"]