From 1893d1fb8d5b94809711ae82c4b56e13155c5ce5 Mon Sep 17 00:00:00 2001 From: Didier Wenzek Date: Tue, 14 May 2024 14:11:34 +0200 Subject: [PATCH] Do not panic changing ownership of device cert Signed-off-by: Didier Wenzek --- crates/core/tedge/src/cli/connect/command.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/core/tedge/src/cli/connect/command.rs b/crates/core/tedge/src/cli/connect/command.rs index 0ebecc0429b..93fc71eaef1 100644 --- a/crates/core/tedge/src/cli/connect/command.rs +++ b/crates/core/tedge/src/cli/connect/command.rs @@ -24,6 +24,7 @@ use tedge_config::*; use tedge_utils::paths::create_directories; use tedge_utils::paths::ok_if_not_found; use tedge_utils::paths::DraftFile; +use tracing::warn; use which::which; use crate::bridge::AWS_CONFIG_FILENAME; @@ -564,8 +565,9 @@ fn restart_mosquitto( &bridge_config.bridge_certfile, &bridge_config.bridge_keyfile, ] { - // TODO maybe ignore errors here - tedge_utils::file::change_user_and_group(path.as_ref(), user, group).unwrap(); + if let Err(err) = tedge_utils::file::change_user_and_group(path.as_ref(), user, group) { + warn!("Failed to change ownership of {path} to {user}:{group}: {err}"); + } } if let Err(err) = service_manager.restart_service(SystemService::Mosquitto) {