Fix NFS export parsing to handle both inline and continuation formats
All checks were successful
Build and Release / build-and-release (push) Successful in 1m20s
All checks were successful
Build and Release / build-and-release (push) Successful in 1m20s
Support exportfs output where network info appears on same line as path (e.g. /srv/media/tv 192.168.0.0/16(...)) in addition to continuation line format. Ensures all NFS exports are detected correctly.
This commit is contained in:
parent
dcd350ec2c
commit
1656f20e96
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
||||
|
||||
[[package]]
|
||||
name = "cm-dashboard"
|
||||
version = "0.1.273"
|
||||
version = "0.1.274"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
@ -301,7 +301,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cm-dashboard-agent"
|
||||
version = "0.1.273"
|
||||
version = "0.1.274"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@ -325,7 +325,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cm-dashboard-shared"
|
||||
version = "0.1.273"
|
||||
version = "0.1.274"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"serde",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard-agent"
|
||||
version = "0.1.274"
|
||||
version = "0.1.275"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -1067,15 +1067,36 @@ impl SystemdCollector {
|
||||
}
|
||||
|
||||
if trimmed.starts_with('/') {
|
||||
// New export path line
|
||||
current_path = trimmed.split_whitespace().next().map(|s| s.to_string());
|
||||
// Export path line - may have network on same line or continuation
|
||||
let parts: Vec<&str> = trimmed.splitn(2, char::is_whitespace).collect();
|
||||
let path = parts[0].to_string();
|
||||
current_path = Some(path.clone());
|
||||
|
||||
// Check if network info is on the same line
|
||||
if parts.len() > 1 {
|
||||
let rest = parts[1].trim();
|
||||
if let Some(paren_pos) = rest.find('(') {
|
||||
let network = rest[..paren_pos].trim();
|
||||
|
||||
if let Some(end_paren) = rest.find(')') {
|
||||
let options = &rest[paren_pos+1..end_paren];
|
||||
let mode = if options.contains(",rw,") || options.ends_with(",rw") {
|
||||
"rw"
|
||||
} else {
|
||||
"ro"
|
||||
};
|
||||
|
||||
exports_map.entry(path)
|
||||
.or_insert_with(Vec::new)
|
||||
.push((network.to_string(), mode.to_string()));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if let Some(ref path) = current_path {
|
||||
// Continuation line with network and options
|
||||
// Format: "192.168.0.0/16(options...)"
|
||||
if let Some(paren_pos) = trimmed.find('(') {
|
||||
let network = trimmed[..paren_pos].trim();
|
||||
|
||||
// Extract ro/rw from options
|
||||
if let Some(end_paren) = trimmed.find(')') {
|
||||
let options = &trimmed[paren_pos+1..end_paren];
|
||||
let mode = if options.contains(",rw,") || options.ends_with(",rw") {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard"
|
||||
version = "0.1.274"
|
||||
version = "0.1.275"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard-shared"
|
||||
version = "0.1.274"
|
||||
version = "0.1.275"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user