summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexandru solomes <solo@softwareag.com>2022-08-31 22:03:32 +0100
committeralexandru solomes <solo@softwareag.com>2022-08-31 22:03:32 +0100
commit9ec91ebbae04d492a9ab8da29582dcbc59205660 (patch)
treeba69530caa5c46b40c9d9cbae4d6aad50acf4fb4
parentfda2176ef6bea7600a11b2a2620246bfaa3f6c3f (diff)
fixed tedge agent --init duplicating sub folders
fixed a bug where the tedge agent logs directory was duplicated on --init call Signed-off-by: alexandru solomes <solo@softwareag.com>
-rw-r--r--crates/core/tedge_agent/src/agent.rs9
1 files changed, 1 insertions, 8 deletions
diff --git a/crates/core/tedge_agent/src/agent.rs b/crates/core/tedge_agent/src/agent.rs
index 69acdd40..d18baf9e 100644
--- a/crates/core/tedge_agent/src/agent.rs
+++ b/crates/core/tedge_agent/src/agent.rs
@@ -229,15 +229,8 @@ impl SmAgent {
pub async fn init(&mut self, config_dir: PathBuf) -> Result<(), anyhow::Error> {
// `config_dir` by default is `/etc/tedge` (or whatever the user sets with --config-dir)
let config_dir = config_dir.display();
- let log_path = self.config.log_dir.display();
create_directory_with_user_group(&format!("{config_dir}/.agent"), "tedge", "tedge", 0o775)?;
- create_directory_with_user_group(&format!("{log_path}/tedge"), "tedge", "tedge", 0o775)?;
- create_directory_with_user_group(
- &format!("{log_path}/tedge/agent"),
- "tedge",
- "tedge",
- 0o775,
- )?;
+ create_directory_with_user_group(self.config.log_dir.clone(), "tedge", "tedge", 0o775)?;
info!("Initializing the tedge agent session");
mqtt_channel::init_session(&self.config.mqtt_config).await?;