From 56157073a77a45ae369a12f83509c6921abe6959 Mon Sep 17 00:00:00 2001 From: Krzysztof Piotrowski Date: Mon, 8 Jan 2024 14:11:43 +0000 Subject: [PATCH] Rename enable.sudo to sudo.enable Signed-off-by: Krzysztof Piotrowski --- .../common/tedge_config/src/tedge_config_cli/tedge_config.rs | 4 ++-- .../src/tedge_config_cli/tedge_config_repository.rs | 2 +- crates/core/tedge_agent/src/agent.rs | 2 +- crates/core/tedge_write/src/lib.rs | 2 +- plugins/tedge_configuration_plugin/src/lib.rs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/common/tedge_config/src/tedge_config_cli/tedge_config.rs b/crates/common/tedge_config/src/tedge_config_cli/tedge_config.rs index d4584ed8e2d..ae91450506a 100644 --- a/crates/common/tedge_config/src/tedge_config_cli/tedge_config.rs +++ b/crates/common/tedge_config/src/tedge_config_cli/tedge_config.rs @@ -777,11 +777,11 @@ define_tedge_config! { }, }, - enable: { + sudo: { /// Determines if thin-edge should use `sudo` when attempting to write to files possibly /// not owned by `tedge`. #[tedge_config(default(value = true), example = "true", example = "false")] - sudo: bool, + enable: bool, }, } diff --git a/crates/common/tedge_config/src/tedge_config_cli/tedge_config_repository.rs b/crates/common/tedge_config/src/tedge_config_cli/tedge_config_repository.rs index b7b6d1f9ac4..0e779ea13a1 100644 --- a/crates/common/tedge_config/src/tedge_config_cli/tedge_config_repository.rs +++ b/crates/common/tedge_config/src/tedge_config_cli/tedge_config_repository.rs @@ -64,7 +64,7 @@ impl TEdgeConfigRepository { /// /// assert_eq!(&config.service.ty, "service"); /// // Defaults are preserved - /// assert_eq!(config.enable.sudo, true); + /// assert_eq!(config.sudo.enable, true); /// ``` pub fn load_toml_str(toml: &str) -> TEdgeConfig { let dto = super::figment::extract_from_toml_str(toml).unwrap(); diff --git a/crates/core/tedge_agent/src/agent.rs b/crates/core/tedge_agent/src/agent.rs index f605748b0e1..f58f09208f4 100644 --- a/crates/core/tedge_agent/src/agent.rs +++ b/crates/core/tedge_agent/src/agent.rs @@ -147,7 +147,7 @@ impl AgentConfig { let identity = tedge_config.http.client.auth.identity()?; - let is_sudo_enabled = tedge_config.enable.sudo; + let is_sudo_enabled = tedge_config.sudo.enable; let capabilities = Capabilities { config_update: tedge_config.agent.enable.config_update, diff --git a/crates/core/tedge_write/src/lib.rs b/crates/core/tedge_write/src/lib.rs index 295d61c823e..68ff64cd609 100644 --- a/crates/core/tedge_write/src/lib.rs +++ b/crates/core/tedge_write/src/lib.rs @@ -8,7 +8,7 @@ //! handling operations where we need to write to user-owned files, tedge components will spawn a //! `tedge-write` process in order to reduce the surface where the root permissions are used. //! -//! This behaviour can be disabled by setting an `enable.sudo` flag to `false`. `tedge-write` will +//! This behaviour can be disabled by setting an `sudo.enable` flag to `false`. `tedge-write` will //! then be ran with effective permissions of the user running the `tedge-agent` binary. With this //! configuration, it the agent will only be able to update configuration files which are writable //! by this user (in practice `tedge` or `root`) diff --git a/plugins/tedge_configuration_plugin/src/lib.rs b/plugins/tedge_configuration_plugin/src/lib.rs index ac2ac068a2f..e63c15bc1e4 100644 --- a/plugins/tedge_configuration_plugin/src/lib.rs +++ b/plugins/tedge_configuration_plugin/src/lib.rs @@ -135,7 +135,7 @@ async fn run_with( mqtt_topic_root: MqttSchema::with_root(mqtt_topic_root.to_string()), mqtt_device_topic_id: mqtt_device_topic_id.to_string().parse()?, tmp_path: Arc::from(tedge_config.tmp.path.as_path()), - is_sudo_enabled: tedge_config.enable.sudo, + is_sudo_enabled: tedge_config.sudo.enable, config_update_enabled: true, })?;