summaryrefslogtreecommitdiffstats
path: root/crates/core/tedge_agent/src/agent.rs
diff options
context:
space:
mode:
authorPradeepKiruvale <pradeepkumar.kj@softwareag.com>2022-04-11 15:13:32 +0530
committerGitHub <noreply@github.com>2022-04-11 15:13:32 +0530
commit34ffb846e67b7ccee34348e1d899c12b9bda3756 (patch)
treeb4bab320e381ba2fa482a156f85fe4eab3cdbb1b /crates/core/tedge_agent/src/agent.rs
parenta718ea43f89d3d7494624da4b226d2eff101acb0 (diff)
Closes #1040 use config-dir feature for initalize and run (#1059)
Diffstat (limited to 'crates/core/tedge_agent/src/agent.rs')
-rw-r--r--crates/core/tedge_agent/src/agent.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/core/tedge_agent/src/agent.rs b/crates/core/tedge_agent/src/agent.rs
index df41368f..94b0b07f 100644
--- a/crates/core/tedge_agent/src/agent.rs
+++ b/crates/core/tedge_agent/src/agent.rs
@@ -224,8 +224,14 @@ impl SmAgent {
}
#[instrument(skip(self), name = "sm-agent")]
- pub async fn init(&mut self) -> Result<(), anyhow::Error> {
- create_directory_with_user_group("/etc/tedge/.agent", "tedge-agent", "tedge-agent", 0o775)?;
+ 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-agent",
+ "tedge-agent",
+ 0o775,
+ )?;
create_directory_with_user_group(
"/var/log/tedge/agent",
"tedge-agent",