mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2026-11-02 20:30:15 -06:00
Strong error checking in the Python side
This commit is contained in:
1 parent
1338aedcc9
commit
f76da3c727
2 files changed
+10
-3
No files matched your search
@@ -124,3 +124,4 @@ src/rust/lqosd/lts_keys.bin
|
||||
src/rust/lqosd/src/node_manager/js_build/out
|
||||
src/bin/dashboards
|
||||
.aider*
|
||||
src/geo2.bin
|
||||
@@ -807,12 +807,18 @@ fn insight_topology_role() -> PyResult<String> {
|
||||
|
||||
#[pyfunction]
|
||||
fn calculate_hash() -> PyResult<i64> {
|
||||
let config = lqos_config::load_config().unwrap();
|
||||
let Ok(config) = lqos_config::load_config() else {
|
||||
return Ok(0);
|
||||
};
|
||||
let nj_path = Path::new(&config.lqos_directory).join("network.json");
|
||||
let sd_path = Path::new(&config.lqos_directory).join("ShapedDevices.csv");
|
||||
|
||||
let nj_as_string = read_to_string(nj_path)?;
|
||||
let sd_as_string = read_to_string(sd_path)?;
|
||||
let Ok(nj_as_string) = read_to_string(nj_path) else {
|
||||
return Ok(0);
|
||||
};
|
||||
let Ok(sd_as_string) = read_to_string(sd_path) else {
|
||||
return Ok(0);
|
||||
};
|
||||
let combined = format!("{}\n{}", nj_as_string, sd_as_string);
|
||||
let hash = hash_to_i64(&combined);
|
||||
|
||||
|
||||
Reference in new issue
Block a user