From 18344c7cd2c622eca0e122fa23a3c3484150c468 Mon Sep 17 00:00:00 2001 From: Herbert Wolverson Date: Wed, 19 Jun 2024 15:20:34 -0500 Subject: [PATCH] Add support for bin/post_integration_hook.sh in scheduler.py Scheduler.py now checks for the existence of a `bin/post_integration_hook.sh` script. If it exists, it is executed immediately after CRM updating and before LibreQoS is refreshed. This gives an opportuntity to start adding additional chains of calls to work with your shaped devices and network.json after CRM retrieval, and before pushing to live. --- src/scheduler.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/scheduler.py b/src/scheduler.py index 17f33bfc..85041606 100644 --- a/src/scheduler.py +++ b/src/scheduler.py @@ -13,6 +13,7 @@ if automatic_import_sonar(): from integrationSonar import importFromSonar from apscheduler.schedulers.background import BlockingScheduler from apscheduler.executors.pool import ThreadPoolExecutor +import os.path ads = BlockingScheduler(executors={'default': ThreadPoolExecutor(1)}) @@ -40,6 +41,12 @@ def importFromCRM(): except: print("Failed to import from Sonar") + # Post-CRM Hooks + path = get_libreqos_directory() + "/bin/post_integration_hook.sh" + binPath = get_libreqos_directory() + "/bin" + if os.path.isfile(path): + subprocess.Popen(path, cwd=binPath) + def graphHandler(): try: refreshBandwidthGraphs()