Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tedge config agent.state.path setting #2492

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

didier-wenzek
Copy link
Contributor

Proposed changes

  • A new tedge-config setting has been added: agent.state.path
  • This path is used to store the tedge-agent state across restarts.
  • If for some reasons this directory cannot be used (doesn't exist or is not writable),
    then the tedge-agent use /etc/tedge/.agent as a fallback.
  • The default value for agent.state.path is /data/tedge/agent.
agent.state.path
   The directory where the tedge-agent persists its state across restarts. 
   Note: If the given directory doesn't exists, `/etc/tedge/.agent` is used as a fallback irrespective of the current setting.
   Example: /data/tedge/agent

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue

#2488

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

Copy link

codecov bot commented Nov 30, 2023

Codecov Report

Merging #2492 (7747a16) into main (1c9e284) will increase coverage by 0.0%.
The diff coverage is 82.5%.

Additional details and impacted files
Files Coverage Δ
...ates/core/tedge_agent/src/restart_manager/actor.rs 39.5% <100.0%> (+1.0%) ⬆️
...ates/core/tedge_agent/src/restart_manager/tests.rs 94.2% <100.0%> (+<0.1%) ⬆️
...tes/core/tedge_agent/src/software_manager/actor.rs 63.2% <100.0%> (-0.2%) ⬇️
...tes/core/tedge_agent/src/software_manager/tests.rs 93.7% <100.0%> (+<0.1%) ⬆️
.../tedge_config/src/tedge_config_cli/tedge_config.rs 80.8% <90.9%> (+0.1%) ⬆️
...tes/core/tedge_agent/src/state_repository/state.rs 91.9% <96.4%> (+1.2%) ⬆️
...tes/core/tedge_agent/src/restart_manager/config.rs 0.0% <0.0%> (-45.9%) ⬇️
...es/core/tedge_agent/src/software_manager/config.rs 0.0% <0.0%> (-34.6%) ⬇️

... and 2 files with indirect coverage changes

Copy link
Contributor

github-actions bot commented Nov 30, 2023

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
388 0 3 388 100 55m2.182999999s

@@ -73,11 +96,18 @@ mod tests {
pub operation: String,
}

fn new_test_state_repository(temp_dir: &TempTedgeDir) -> AgentStateRepository<State> {
AgentStateRepository::new(
"/some/unknown/dir".into(),
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit surprising to see that this relies on the unhappy path to store in {temp_dir}/.agent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it would be good to test the happy path too. Will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@jarhodes314 jarhodes314 left a comment

Choose a reason for hiding this comment

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

Looks good. I've left a couple of minor comments

This path is used to store the tedge-agent state across restarts.
If the given path is not set or doesn't exist,
then the tedge-agent use /etc/tedge/.agent as a fallback.

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
@didier-wenzek didier-wenzek merged commit 8457fa6 into thin-edge:main Dec 1, 2023
18 checks passed
@didier-wenzek didier-wenzek deleted the feat/agent-state-path branch February 7, 2024 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants