diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-04-25 21:09:02 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-04-30 09:28:10 +0200 |
commit | 869f55865f60fe125b6be6c3a76913e9b12d8b71 (patch) | |
tree | 3fbcbd543a476717a145f5424c61a4b595bec908 /vtysh | |
parent | Merge pull request #2110 from msablic/pim_mtrace_group (diff) | |
download | frr-869f55865f60fe125b6be6c3a76913e9b12d8b71.tar.xz frr-869f55865f60fe125b6be6c3a76913e9b12d8b71.zip |
vtysh: fix failure to write config w/o watchfrr
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'vtysh')
-rw-r--r-- | vtysh/vtysh.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index cdc047e5a..867dc9cd1 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2611,20 +2611,25 @@ DEFUN (vtysh_write_memory, /* If integrated frr.conf explicitely set. */ if (want_config_integrated()) { ret = CMD_WARNING_CONFIG_FAILED; + + /* first attempt to use watchfrr if it's available */ + bool used_watchfrr = false; + for (i = 0; i < array_size(vtysh_client); i++) if (vtysh_client[i].flag == VTYSH_WATCHFRR) break; - if (i < array_size(vtysh_client) && vtysh_client[i].fd != -1) + if (i < array_size(vtysh_client) && vtysh_client[i].fd != -1) { + used_watchfrr = true; ret = vtysh_client_execute(&vtysh_client[i], "do write integrated", outputfile); + } /* - * If watchfrr returns CMD_WARNING_CONFIG_FAILED this means - * that it could not write the config, but additionally - * indicates that we should not try either + * If we didn't use watchfrr, fallback to writing the config + * ourselves */ - if (ret != CMD_SUCCESS && ret != CMD_WARNING_CONFIG_FAILED) { + if (!used_watchfrr) { printf("\nWarning: attempting direct configuration write without " "watchfrr.\nFile permissions and ownership may be " "incorrect, or write may fail.\n\n"); |