diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-09-26 19:30:47 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2019-10-07 20:01:45 +0000 |
commit | eda8b7b23d97994f7e9d1d6554ba4657b6531ad8 (patch) | |
tree | 0b4f1f21823c9769f12d6477cda7db612bc435fa /src | |
parent | 9168cc9830e11942a1f821a152c1c77be01ccb0a (diff) |
vty: Optionally Set/replace cfg file during cmd 'write file'
This way if the process is started with no file associated (eg. no -c
param and default cfg path doesn't exist), config can be later saved
into a file by passing the parameter. Otherwise, until now this message
was displayed:
Can't save to configuration file, using vtysh.
Related: OS#4024
Change-Id: I38edcf902a08b6bd0ebb9aa6fc1a7041421af525
Diffstat (limited to 'src')
-rw-r--r-- | src/vty/command.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/vty/command.c b/src/vty/command.c index 35169eb0..0d24b667 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -2927,9 +2927,10 @@ static int write_config_file(const char *config_file, char **outpath) /* Write current configuration into file. */ DEFUN(config_write_file, config_write_file_cmd, - "write file", + "write file [PATH]", "Write running configuration to memory, network, or terminal\n" - "Write to configuration file\n") + "Write to configuration file\n" + "Set file path to store the config, or replace if already exists\n") { char *failed_file; int rc; @@ -2943,6 +2944,9 @@ DEFUN(config_write_file, } } + if (argc == 1) + host_config_set(argv[0]); + if (host.config == NULL) { vty_out(vty, "Can't save to configuration file, using vtysh.%s", VTY_NEWLINE); |