Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNIX copy command to load/save/check .cfg files #373

Open
troglobit opened this issue Apr 1, 2024 · 5 comments
Open

UNIX copy command to load/save/check .cfg files #373

troglobit opened this issue Apr 1, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@troglobit
Copy link
Contributor

Suggestion to add a command line tool, similar to sysrepocfg, but one that knows more about Infix.

  • Prefers /cfg for storing files
  • Supports validation of .cfg files, when importing old backups
  • Provides a stable API for external users
@troglobit
Copy link
Contributor Author

@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.

@wkz
Copy link
Contributor

wkz commented Apr 2, 2024

I like it!

Some initial thoughts:

  • Since we might want a configure program in the future (retiring cli and letting bash assume the role of admin-exec), I think we should choose a name that is a bit more distinct in order to avoid future confusion. Maybe cfgcp for "configuration copy"
  • Validation could probably make use of yanglint's -Y option.
  • cfgcp could have a -n/--dry-run option that only runs validation

@troglobit
Copy link
Contributor Author

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>

@wkz
Copy link
Contributor

wkz commented Apr 2, 2024

Yes, that is way better than my suggestion! 👍

@troglobit troglobit changed the title RFC: cfg to load/save and validate .cfg files UNIX copy command to load/save/check .cfg files Apr 3, 2024
@troglobit troglobit added the enhancement New feature or request label Apr 4, 2024
@troglobit troglobit pinned this issue Apr 24, 2024
@troglobit
Copy link
Contributor Author

Make sure to clean up any relative-path checks as well, see #717 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants