diff options
author | Marcel Müller <m.mueller@ifm.com> | 2022-04-22 10:52:59 +0200 |
---|---|---|
committer | Marcel Müller <m.mueller@ifm.com> | 2022-05-24 11:53:17 +0200 |
commit | 295f125878790fe8794e90dda0105e6b568060b4 (patch) | |
tree | 1aac7701b2e7e54f9864dfda2d89f229faee6d8a | |
parent | bed3ed4cf7df1be1f015dc8f9a33b2997e584f59 (diff) |
Adapt tedge binary to new error types
Signed-off-by: Marcel Müller <m.mueller@ifm.com>
-rw-r--r-- | Cargo.lock | 8 | ||||
-rw-r--r-- | tedge/Cargo.toml | 2 | ||||
-rw-r--r-- | tedge/simple-config.toml | 36 | ||||
-rw-r--r-- | tedge/src/main.rs | 21 |
4 files changed, 43 insertions, 24 deletions
@@ -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?) } |