* Adds a "get LibreQOS directory" function to the Python library.
* Uses it to establish the correct location for uisp_integration.
* Modifies `scheduler.py` to call the new UISP integration directly.
This commit is contained in:
Herbert Wolverson 2024-06-17 08:50:57 -05:00
parent 6ed0b88104
commit 4930c47ab0
2 changed files with 12 additions and 4 deletions

View File

@ -90,6 +90,7 @@ fn liblqos_python(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_wrapped(wrap_pyfunction!(influx_db_url))?; m.add_wrapped(wrap_pyfunction!(influx_db_url))?;
m.add_wrapped(wrap_pyfunction!(get_weights))?; m.add_wrapped(wrap_pyfunction!(get_weights))?;
m.add_wrapped(wrap_pyfunction!(get_tree_weights))?; m.add_wrapped(wrap_pyfunction!(get_tree_weights))?;
m.add_wrapped(wrap_pyfunction!(get_libreqos_directory))?;
Ok(()) Ok(())
} }
@ -662,3 +663,9 @@ pub fn get_tree_weights() -> PyResult<Vec<device_weights::NetworkNodeWeight>> {
} }
} }
} }
#[pyfunction]
pub fn get_libreqos_directory() -> PyResult<String> {
let config = lqos_config::load_config().unwrap();
Ok(config.lqos_directory)
}

View File

@ -2,10 +2,9 @@ import time
import datetime import datetime
from LibreQoS import refreshShapers, refreshShapersUpdateOnly from LibreQoS import refreshShapers, refreshShapersUpdateOnly
from graphInfluxDB import refreshBandwidthGraphs, refreshLatencyGraphs from graphInfluxDB import refreshBandwidthGraphs, refreshLatencyGraphs
import subprocess
from liblqos_python import automatic_import_uisp, automatic_import_splynx, queue_refresh_interval_mins, \ from liblqos_python import automatic_import_uisp, automatic_import_splynx, queue_refresh_interval_mins, \
automatic_import_powercode, automatic_import_sonar, influx_db_enabled automatic_import_powercode, automatic_import_sonar, influx_db_enabled, get_libreqos_directory
if automatic_import_uisp():
from integrationUISP import importFromUISP
if automatic_import_splynx(): if automatic_import_splynx():
from integrationSplynx import importFromSplynx from integrationSplynx import importFromSplynx
if automatic_import_powercode(): if automatic_import_powercode():
@ -20,7 +19,9 @@ ads = BlockingScheduler(executors={'default': ThreadPoolExecutor(1)})
def importFromCRM(): def importFromCRM():
if automatic_import_uisp(): if automatic_import_uisp():
try: try:
importFromUISP() # Call bin/uisp_integration
path = get_libreqos_directory() + "/bin/uisp_integration"
subprocess.run([path])
except: except:
print("Failed to import from UISP") print("Failed to import from UISP")
elif automatic_import_splynx(): elif automatic_import_splynx():