From 4de3f3778596bfac6ab2318373b0d8aee2323bcf Mon Sep 17 00:00:00 2001 From: Allen Hogan <98360253+alhogan@users.noreply.github.com> Date: Thu, 15 Feb 2024 09:06:23 -0600 Subject: [PATCH] added decorator to close db connections for threaded tasks (#715) --- nautobot_golden_config/nornir_plays/config_deployment.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nautobot_golden_config/nornir_plays/config_deployment.py b/nautobot_golden_config/nornir_plays/config_deployment.py index b59502fd..2dc98b69 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 import logging @@ -21,13 +22,13 @@ from nautobot_golden_config.nornir_plays.processor import ProcessGoldenConfig from nautobot_golden_config.utilities.helper import dispatch_params from nautobot_golden_config.utilities.logger import NornirLogger - - +from nautobot_golden_config.utilities.db_management import close_threaded_db_connections from nautobot_golden_config.utilities.constant import DEFAULT_DEPLOY_STATUS InventoryPluginRegister.register("nautobot-inventory", NautobotORMInventory) +@close_threaded_db_connections def run_deployment(task: Task, logger: logging.Logger, config_plan_qs, deploy_job_result) -> Result: """Deploy configurations to device.""" obj = task.host.data["obj"]