Skip to content

Commit

Permalink
added decorator to close db connections for threaded tasks (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
alhogan authored Feb 15, 2024
1 parent ec8ffeb commit 4de3f37
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nautobot_golden_config/nornir_plays/config_deployment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Nornir job for deploying configurations."""

from datetime import datetime
import logging

Expand All @@ -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"]
Expand Down

0 comments on commit 4de3f37

Please sign in to comment.