Open reubenmiller opened 1 month ago
QA troughly check was done during the development/implementation of this feature. Suggested steps to be added in the test case are done properly the review was done in: https://github.com/thin-edge/thin-edge.io/pull/2943
Is your feature request related to a problem? Please describe.
Editing tedge config values which are arrays is difficult to managed for users as it involves checking the initial value, and adding the new value only if it is not already included in the list. Most of the time the "thing" adding the new value does not care about the existing values, and just wants to make sure the value it cares about is added to the list without breaking any other components.
There are currently the following tedge config settings which expect an array:
The problem can be demonstrated via the tedge config
c8y.smartrest.templates
setting.Package 1 includes an operation handler which requires subscribing to a SmartREST template called
collection1
After adding the
collection1
template, the configuration get be retrieved using:Package 2 includes another operation handlers which requires subscribing to a different SmartREST template called
collection2
The package can't just run the following command, as it would overwrite the existing value from the previous step, so it requires more complex logic using jq to splice in a new value (below adds the new values, and then removes any duplicated template names)
Note If the user would not have
jq
then the logic was be more complex (and naive):Describe the solution you'd like
Add new subcommands for
tedge config
to "add" and "remove" values from an array.Below shows an example of some of the commands (and the result of the setting afterwards)
tedge config add {prop} {value}
tedge config set
)tedge config remove {prop} {value}
tedge config unset
)Describe alternatives you've considered
Additional context