Skip to content

Conversation

Bravo555
Copy link
Member

@Bravo555 Bravo555 commented Sep 3, 2024

Proposed changes

If tedge-failed, process error code and stderr were printed 2 times like this:

failed to deploy configuration file: process '/usr/bin/sudo' returned non-zero exit code (1); stderr="sudo: a password is required": process '/usr/bin/sudo' returned non-zero exit code (1); stderr="sudo: a password is required"

Now it doesn't contain a duplicate:

failed to deploy configuration file: process '/usr/bin/sudo' returned non-zero exit code (1); stderr="sudo: a password is required"

This was due to unnoticed wrapping of the error types: all the functions returned ConfigManagementError, but we still wanted to attach context, so we had the following nesting, which screwed up anyhow's error causes formatting:

ConfigManagementError::Other(anyhow::Error(source: ConfigManagementError::Other(anyhow::Error)))

Immediate function error type was changed to anyhow::Error, so now we only have a single conversion to ConfigManagementError on the outermost function.

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


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

Question to @reubenmiller: how to tag these small PRs that are fixes, but minor ones, for which no issue was reported? I could tag this as an improvement, but it would probably be a bit misleading since the previous behaviour really was unintended, so for release notes perhaps it should categorised as a fix?

If tedge-failed, process error code and stderr were printed 2 times like
this:

```
failed to deploy configuration file: process '/usr/bin/sudo' returned
non-zero exit code (1); stderr="sudo: a password is required": process
'/usr/bin/sudo' returned non-zero exit code (1); stderr="sudo: a
password is required"
```

This was due to unnoticed wrapping of the error types: all the functions
returned `ConfigManagementError`, but we still wanted to attach context,
so we had the following nesting:

ConfigManagementError::Other(anyhow::Error(source: ConfigManagementError::Other(anyhow::Error)))

Immediate function error type was changed to anyhow::Error, so we only
have a single conversion to ConfigManagementError on the outernmost
function.

Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rates/extensions/tedge_config_manager/src/actor.rs 33.33% 2 Missing ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

Copy link
Contributor

github-actions bot commented Sep 3, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
499 0 2 499 100 1h33m12.757460999s

@Bravo555 Bravo555 added the theme:configuration Theme: Configuration management label Sep 3, 2024
Copy link
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

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

Approved

@Bravo555 Bravo555 added this pull request to the merge queue Sep 3, 2024
Merged via the queue into thin-edge:main with commit 94d43f2 Sep 3, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:configuration Theme: Configuration management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants