cli: add 'validate', or '-n', dry run to copy command

This commit adds config file validation to the copy command, discussed
in #373.  Allowing users to test their config files before restoring a
backup.  The feature could also be used for the automatic rollback when
downgrading to an earlier version of the OS.

Fixes #373

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2025-10-23 15:23:58 +02:00
parent 3b24fab324
commit e6a04fbd95
4 changed files with 47 additions and 23 deletions
+9 -1
View File
@@ -191,4 +191,12 @@ change that, e.g., breaks networking, it is trivial to revert back by:
admin@host-12-34-56:/> copy startup-config running-config
```
Or restarting the device.
Or restart the device, for example if the change to the configuration
caused you to lose contact with the system (it happens to the best of
us). The system will start up from the last "save gave".
> **Tip:** when restoring a backup of a configuration, or having manually
> edited a config file, you can validate it using system's YANG models,
> it is *not* applied if validation is successful:
>
> `copy /media/backup/old.cfg running-config validate`