summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Müller <m.mueller@ifm.com>2022-04-22 10:52:59 +0200
committerMarcel Müller <m.mueller@ifm.com>2022-05-24 11:53:17 +0200
commit295f125878790fe8794e90dda0105e6b568060b4 (patch)
tree1aac7701b2e7e54f9864dfda2d89f229faee6d8a
parentbed3ed4cf7df1be1f015dc8f9a33b2997e584f59 (diff)
Adapt tedge binary to new error types
Signed-off-by: Marcel Müller <m.mueller@ifm.com>
-rw-r--r--Cargo.lock8
-rw-r--r--tedge/Cargo.toml2
-rw-r--r--tedge/simple-config.toml36
-rw-r--r--tedge/src/main.rs21
4 files changed, 43 insertions, 24 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 71a4b03e..9e720474 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1588,9 +1588,9 @@ dependencies = [
[[package]]
name = "miette"
-version = "4.4.0"
+version = "4.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0a097de91d72c13382f60213ed9f7f7a26afd8bee0ea320b47f886a9a67ca5a1"
+checksum = "1c90329e44f9208b55f45711f9558cec15d7ef8295cc65ecd6d4188ae8edc58c"
dependencies = [
"atty",
"backtrace",
@@ -1608,9 +1608,9 @@ dependencies = [
[[package]]
name = "miette-derive"
-version = "4.4.0"
+version = "4.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45a95a48d0bc28f9af628286e8a4da09f96f34a97744a2e9a5a4db9814ad527d"
+checksum = "6b5bc45b761bcf1b5e6e6c4128cd93b84c218721a8d9b894aa0aff4ed180174c"
dependencies = [
"proc-macro2 1.0.38",
"quote 1.0.18",
diff --git a/tedge/Cargo.toml b/tedge/Cargo.toml
index ff1b01ef..9995b741 100644
--- a/tedge/Cargo.toml
+++ b/tedge/Cargo.toml
@@ -9,7 +9,7 @@ edition = "2021"
clap = { version = "3", features = ["derive", "cargo", "suggestions"] }
toml = "0.5.8"
tokio = { version = "1", features = ["fs", "macros", "rt-multi-thread", "signal"] }
-miette = { version = "4.4", features = ["fancy"] }
+miette = { version = "4.7", features = ["fancy"] }
cfg-if = "1"
tracing = "0.1"
tracing-subscriber = { version = "0.3.11", features = ["env-filter"] }
diff --git a/tedge/simple-config.toml b/tedge/simple-config.toml
new file mode 100644
index 00000000..faa49597
--- /dev/null
+++ b/tedge/simple-config.toml
@@ -0,0 +1,36 @@
+communication_buffer_size = 10
+
+plugin_shutdown_timeout_ms = 10000
+
+[plugins]
+
+[plugins.logging]
+kind = "log"
+configuration_file = "./example-config-logging.toml"
+
+
+[plugins.syscpu]
+kind = "sysinfo"
+
+[plugins.syscpu.configuration.cpu]
+send_to = ["loggin"]
+interval_ms = 1000
+
+[plugins.syscpu.configuration.cpu.report_global_processor_info]
+enable = true
+frequency = true
+cpu_usage = true
+name = true
+vendor_id = true
+brand = true
+
+[plugins.syscpu.configuration.cpu.report_processor_info]
+enable = false
+frequency = false
+cpu_usage = false
+name = false
+vendor_id = false
+brand = false
+
+[plugins.syscpu.configuration.cpu.report_physical_core_count]
+enable = false
diff --git a/tedge/src/main.rs b/tedge/src/main.rs
index e957ea34..01d3d298 100644
--- a/tedge/src/main.rs
+++ b/tedge/src/main.rs
@@ -65,7 +65,7 @@ macro_rules! register_plugin {
}));
Registry {
- app_builder: registry.app_builder.with_plugin_builder($pbinstance)?,
+ app_builder: registry.app_builder.with_plugin_builder($pbinstance),
plugin_kinds: registry.plugin_kinds,
doc_printers: registry.doc_printers,
}
@@ -250,22 +250,5 @@ async fn run(
}
async fn validate_config(application: &TedgeApplication) -> miette::Result<()> {
- let mut any_err = false;
- for (plugin_name, res) in application.verify_configurations().await {
- match res {
- Err(e) => {
- error!(%plugin_name, ?e, "Error in Plugin configuration");
- any_err = true;
- }
- Ok(_) => {
- info!(%plugin_name, "Plugin configured correctly");
- }
- }
- }
-
- if any_err {
- Err(miette::miette!("Plugin configuration error"))
- } else {
- Ok(())
- }
+ Ok(application.verify_configurations().await?)
}