thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
222 stars 55 forks source link

Create role based default configs for tedge operation plugins #2447

Closed albinsuresh closed 9 months ago

albinsuresh commented 12 months ago

Is your feature improvement request related to a problem? Please describe.

The tedge-log-plugin and tedge-config-plugin currently creates their configuration files with zero file entries (all example entries commented), as they can run both on main device as well as child devices and those examples only make sense on the main device. Leaving them empty on child devices is acceptable as we can't assume any paths on those devices. But, at least on the main device, some sensible default entries should be present, so that someone using these plugins get to try out those features immediately, without having to update those files.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

reubenmiller commented 9 months ago

The following would be the suggested default settings both the configuration and log management features:

file: /etc/tedge/plugins/tedge-log-plugin.toml

[[files]]
type = "software-management"
path = "/var/log/tedge/agent/software-*"

file: /etc/tedge/plugins/tedge-configuration-plugin.toml

[[files]]
path = "/etc/tedge/tedge.toml"
type = "tedge.toml"

[[files]]
path = "/etc/tedge/plugins/tedge-log-plugin.toml"
type = "tedge-log-plugin"
user = "tedge"
group = "tedge"
mode = 0o0444
albinsuresh commented 9 months ago

Test

Plugin config defaults updated as the described in the previous comment, where the config and log directory path prefixes used in those default path entries are derived from the values passed in the --config-dir argument and the tedge logs.path configuration respectively.

Tests already exist for the config entries using the default config and log paths:

gligorisaev commented 9 months ago

QA has thoroughly checked the feature and here are the results: