Skip to content

Commit

Permalink
Merge pull request #2571 from Ruadhri17/sudo-enable
Browse files Browse the repository at this point in the history
Rename configuration `enable.sudo` to `sudo.enable`
  • Loading branch information
reubenmiller authored Jan 9, 2024
2 parents 5760eae + 5615707 commit 2c7f1bd
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion crates/core/tedge_agent/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion crates/core/tedge_write/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
2 changes: 1 addition & 1 deletion plugins/tedge_configuration_plugin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})?;

Expand Down

1 comment on commit 2c7f1bd

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
378 0 3 378 100 55m48.734999999s

Please sign in to comment.