From 279c6956d90fd4ba8aa0ff60b9a0484b9933f827 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 15 Apr 2016 09:15:21 -0400 Subject: [PATCH] vtysh: Allow file read in to continue in more cases When a duplicate command is read in from a file, there are cases where daemons return CMD_WARNING this causes the command to not be send to subsuquent daemons( if any ). Allow the read in of commands to continue in this situation. Ticket: CM-10393 Signed-off-by: Donald Sharp Reviewed-by: Don Slice --- vtysh/vtysh.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index f7f38049eb..44d67e8f9d 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -723,7 +723,15 @@ vtysh_config_from_file (struct vty *vty, FILE *fp) { cmd_stat = vtysh_client_execute (&vtysh_client[i], vty->buf, stdout); - if (cmd_stat != CMD_SUCCESS) + /* + * CMD_WARNING - Can mean that the command was + * parsed successfully but it was already entered + * in a few spots. As such if we receive a + * CMD_WARNING from a daemon we shouldn't stop + * talking to the other daemons for the particular + * command. + */ + if (cmd_stat != CMD_SUCCESS && cmd_stat != CMD_WARNING) { fprintf (stderr, "line %d: Failure to communicate[%d] to %s, line: %s\n", lineno, cmd_stat, vtysh_client[i].name, vty->buf); -- 2.39.5