UNIX `copy` command to load/save/check .cfg files
Suggestion to add a command line tool, similar to sysrepocfg, but one that knows more about Infix.
- Prefers
/cfgfor storing files - Supports validation of
.cfgfiles, when importing old backups - Provides a stable API for external users
@wkz + @mattiaswal RFC on an idea I that's been floating around for a while. The most important feature in my mind right now is the validation, so that users can verify the new configuration would actually work.
I like it!
Some initial thoughts:
- Since we might want a
configureprogram in the future (retiringcliand lettingbashassume the role of admin-exec), I think we should choose a name that is a bit more distinct in order to avoid future confusion. Maybecfgcpfor "configuration copy" - Validation could probably make use of
yanglint's-Yoption. cfgcpcould have a-n/--dry-runoption that only runs validation
Interesting, maybe as a general rule of thumb, use the same names as we use today in the CLI admin-exec context, in this case copy? Would mean less retraining of personnel and possibly less support issues.
For the validation, my idea was to connect to sysrepo, import the file to candidate, and run the validation/check we do today from the CLI. That way we don't need to first extract all modules and enabled features using sysrepoctl to feed into yanglint.
A validation could then look like:
admin@example:~$ copy --dry-run some-file.cfg running-config
Incompatible source (some-file.cfg) with system YANG models:
<detailed error from libyang via sysrepo>
Yes, that is way better than my suggestion! :+1:
Make sure to clean up any relative-path checks as well, see https://github.com/kernelkit/infix/pull/717#discussion_r1806026263