summaryrefslogtreecommitdiffstats
path: root/crates/core/tedge_agent/src/agent.rs
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@ifm.com>2022-06-21 08:04:11 +0200
committerMatthias Beyer <matthias.beyer@ifm.com>2022-08-06 09:47:18 +0200
commit229259a38f41fb2686031c4bc7748eea324d8ca4 (patch)
tree1a9d2339183daee06fa11e621325220d0fcd4b89 /crates/core/tedge_agent/src/agent.rs
parenta9e04b8ba2bd25eb0102ba42cf8c8d05e7d24250 (diff)
Do not necessarily pass &str anymore to fs helper fns
This patch changs the calls of the fs helper functions where the interface of the functions was changed from taking `&str` as path argument to `impl AsRef<Path>`. Because of this, it is not necessary anymore that `&str` is passed, but `Path`es can be passed or, as in most cases, the ad-hoc created `String` objects can be passed by value instead of by reference, resulting in less mental load on the calling side. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
Diffstat (limited to 'crates/core/tedge_agent/src/agent.rs')
-rw-r--r--crates/core/tedge_agent/src/agent.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/core/tedge_agent/src/agent.rs b/crates/core/tedge_agent/src/agent.rs
index 66573692..d4d723c8 100644
--- a/crates/core/tedge_agent/src/agent.rs
+++ b/crates/core/tedge_agent/src/agent.rs
@@ -227,8 +227,12 @@ impl SmAgent {
#[instrument(skip(self), name = "sm-agent")]
pub async fn init(&mut self, config_dir: PathBuf) -> Result<(), anyhow::Error> {
- let cfg_dir = config_dir.as_path().display().to_string();
- create_directory_with_user_group(&format!("{cfg_dir}/.agent"), "tedge", "tedge", 0o775)?;
+ create_directory_with_user_group(
+ format!("{}/.agent", config_dir.display()),
+ "tedge",
+ "tedge",
+ 0o775,
+ )?;
create_directory_with_user_group("/var/log/tedge/agent", "tedge", "tedge", 0o775)?;
info!("Initializing the tedge agent session");
mqtt_channel::init_session(&self.config.mqtt_config).await?;