Skip to content

Commit f7371c5

Browse files
authored
feature: report network file (#172)
Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
1 parent f7cf582 commit f7371c5

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
88
name = "omnect-device-service"
99
readme = "README.md"
1010
repository = "https://github.com/omnect/omnect-device-service.git"
11-
version = "0.41.7"
11+
version = "0.41.8"
1212

1313
[dependencies]
1414
actix-server = { version = "2.6", default-features = false }

src/twin/mod_test.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ pub mod mod_test {
364364
},
365365
"mac": "50:2d:f4:35:16:25",
366366
"name": "eth0",
367+
"file": "/lib/systemd/network/80-wired.network",
367368
"online": true
368369
},
369370
{
@@ -374,6 +375,7 @@ pub mod mod_test {
374375
},
375376
"mac": "50:2d:f4:2c:0e:51",
376377
"name": "eth1",
378+
"file": "/lib/systemd/network/80-wired.network",
377379
"online": false
378380
}]
379381
}
@@ -512,6 +514,7 @@ pub mod mod_test {
512514
},
513515
"mac": "50:2d:f4:35:16:25",
514516
"name": "eth0",
517+
"file": "/lib/systemd/network/80-wired.network",
515518
"online": true
516519
},
517520
{
@@ -522,6 +525,7 @@ pub mod mod_test {
522525
},
523526
"mac": "50:2d:f4:2c:0e:51",
524527
"name": "eth1",
528+
"file": "/lib/systemd/network/80-wired.network",
525529
"online": false
526530
}]
527531
}

src/twin/network.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub struct Interface {
4343
name: String,
4444
mac: String,
4545
online: bool,
46+
file: String,
4647
ipv4: IpConfig,
4748
}
4849

@@ -171,6 +172,10 @@ impl Network {
171172
error!("parse_interfaces: skip interface ('OnlineState' missing)");
172173
continue;
173174
};
175+
let Some(file) = i["NetworkFile"].as_str() else {
176+
error!("parse_interfaces: skip interface ('NetworkFile' missing)");
177+
continue;
178+
};
174179

175180
let Some(mac) = Self::parse_mac(i, "HardwareAddress") else {
176181
continue;
@@ -245,6 +250,7 @@ impl Network {
245250
name: name.to_string(),
246251
online: online.eq("online"),
247252
mac,
253+
file: file.to_string(),
248254
ipv4,
249255
});
250256
}

0 commit comments

Comments
 (0)