mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2026-11-02 20:30:15 -06:00
Merge pull request #910 from LibreQoE/bug_fix_2
Fix .deb runtime regressions: include missing Python modules and make CRM/NMS config sections optional for lqos_api
This commit is contained in:
3 files changed
+51
No files matched your search
@@ -26,6 +26,7 @@ LQOS_FILES=(
|
||||
integrationSplynx.py
|
||||
integrationUISP.py
|
||||
integrationVISP.py
|
||||
integrationWISPGate.py
|
||||
LibreQoS.py
|
||||
lqos.example
|
||||
lqTools.py
|
||||
@@ -35,6 +36,7 @@ LQOS_FILES=(
|
||||
README.md
|
||||
scheduler.py
|
||||
ShapedDevices.example.csv
|
||||
virtual_tree_nodes.py
|
||||
mikrotikDHCPRouterList.template.csv
|
||||
integrationUISPbandwidths.template.csv
|
||||
manualNetwork.template.csv
|
||||
|
||||
@@ -3,6 +3,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Allocative)]
|
||||
pub struct SplynxIntegration {
|
||||
#[serde(alias = "enable_spylnx")]
|
||||
pub enable_splynx: bool,
|
||||
pub api_key: String,
|
||||
pub api_secret: String,
|
||||
|
||||
@@ -62,6 +62,7 @@ pub struct Config {
|
||||
pub flows: Option<super::flows::FlowConfig>,
|
||||
|
||||
/// Integration Common Variables
|
||||
#[serde(default)]
|
||||
pub integration_common: super::integration_common::IntegrationConfig,
|
||||
|
||||
/// Splynx Integration configuration. Optional so older configs without this
|
||||
@@ -78,12 +79,15 @@ pub struct Config {
|
||||
pub visp_integration: Option<super::visp_integration::VispIntegration>,
|
||||
|
||||
/// UISP Integration
|
||||
#[serde(default)]
|
||||
pub uisp_integration: super::uisp_integration::UispIntegration,
|
||||
|
||||
/// Powercode Integration
|
||||
#[serde(default)]
|
||||
pub powercode_integration: super::powercode_integration::PowercodeIntegration,
|
||||
|
||||
/// Sonar Integration
|
||||
#[serde(default)]
|
||||
pub sonar_integration: super::sonar_integration::SonarIntegration,
|
||||
|
||||
/// InfluxDB Configuration
|
||||
@@ -286,6 +290,25 @@ impl Config {
|
||||
mod test {
|
||||
use super::Config;
|
||||
|
||||
fn remove_sections(raw: &str, sections: &[&str]) -> String {
|
||||
let mut output = Vec::new();
|
||||
let mut skip_section = false;
|
||||
|
||||
for line in raw.lines() {
|
||||
let trimmed = line.trim();
|
||||
if trimmed.starts_with('[') && trimmed.ends_with(']') {
|
||||
let section_name = &trimmed[1..trimmed.len() - 1];
|
||||
skip_section = sections.contains(§ion_name);
|
||||
}
|
||||
|
||||
if !skip_section {
|
||||
output.push(line);
|
||||
}
|
||||
}
|
||||
|
||||
output.join("\n")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn load_example() {
|
||||
let config = Config::load_from_string(include_str!("example.toml"))
|
||||
@@ -330,6 +353,31 @@ mod test {
|
||||
assert!(!config.splynx_integration.enable_splynx);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn load_example_without_integration_sections() {
|
||||
let stripped = remove_sections(
|
||||
include_str!("example.toml"),
|
||||
&[
|
||||
"integration_common",
|
||||
"splynx_integration",
|
||||
"spylnx_integration",
|
||||
"netzur_integration",
|
||||
"visp_integration",
|
||||
"uisp_integration",
|
||||
"powercode_integration",
|
||||
"sonar_integration",
|
||||
"wispgate_integration",
|
||||
],
|
||||
);
|
||||
|
||||
let config = Config::load_from_string(&stripped)
|
||||
.expect("Config without integrations should still deserialize");
|
||||
assert!(!config.splynx_integration.enable_splynx);
|
||||
assert!(!config.uisp_integration.enable_uisp);
|
||||
assert!(!config.powercode_integration.enable_powercode);
|
||||
assert!(!config.sonar_integration.enable_sonar);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_uses_splynx_keys() {
|
||||
let config =
|
||||
|
||||
Reference in new issue
Block a user