Skip to content

Conversation

jarhodes314
Copy link
Contributor

@jarhodes314 jarhodes314 commented Nov 25, 2024

Proposed changes

This adds an optional argument to tedge config list and tedge config list --doc which filters the list of configuration keys shown, since the complete list is now very large.

For example:

$ ./tedge config list --doc 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
  agent.enable.config_update  Determines if tedge-agent should enable config_update operation. 
                              Example: true
agent.enable.config_snapshot  Determines if tedge-agent should enable config_snapshot operation. 
                              Example: true
     agent.enable.log_upload  Determines if tedge-agent should enable log_upload operation. 
                              Example: true

It uses a substring match, so it is easy to search for http related properties or certificate paths:

$ ./tedge config list http
c8y.http=thin-edge-io.eu-latest.cumulocity.com:443
c8y@jrh.http=jrh.latest.stage.c8y.io:443
http.cert_path=/etc/tedge/device-certs/tedge-certificate.pem
http.key_path=/etc/tedge/device-certs/tedge-private-key.pem
http.ca_path=/etc/ssl/certs
http.bind.port=8000
http.bind.address=127.0.0.1
http.client.port=8000
http.client.host=127.0.0.1
$ ./tedge config list --all .cert_path
device.cert_path=/etc/tedge/device-certs/tedge-certificate.pem
http.cert_path=/etc/tedge/device-certs/tedge-certificate.pem

c8y.proxy.cert_path=
c8y@jrh.proxy.cert_path=

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

Signed-off-by: James Rhodes <jarhodes314@gmail.com>
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/core/tedge/src/cli/config/commands/list.rs 82.60% 3 Missing and 1 partial ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

Copy link
Contributor

github-actions bot commented Nov 26, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
524 0 2 524 100 1h31m43.85954s

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

Copy link
Contributor

@albinsuresh albinsuresh left a comment

Choose a reason for hiding this comment

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

LGTM. Initially I was wondering if the filter value should have been behind a --filter option or something like that. But, the proposed usage also looks quite natural.

Copy link
Contributor

@reubenmiller reubenmiller left a comment

Choose a reason for hiding this comment

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

Nice addition

@jarhodes314 jarhodes314 added this pull request to the merge queue Nov 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 29, 2024
@jarhodes314 jarhodes314 added this pull request to the merge queue Nov 29, 2024
github-merge-queue bot pushed a commit that referenced this pull request Nov 29, 2024
feat: add filtering to `tedge config list`
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 29, 2024
@jarhodes314 jarhodes314 added this pull request to the merge queue Nov 29, 2024
Merged via the queue into thin-edge:main with commit e965e13 Nov 29, 2024
33 checks passed
@reubenmiller reubenmiller added this to the 1.4.0 milestone Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:cli Theme: cli related topics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants