]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: silence overly verbose CLI warning 7025/head
authorRenato Westphal <renato@opensourcerouting.org>
Mon, 31 Aug 2020 14:58:24 +0000 (11:58 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Mon, 31 Aug 2020 14:59:54 +0000 (11:59 -0300)
When not using the transactional CLI mode, do not display a
warning when a YANG-modeled commmand doesn't perform any effective
configuration change.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
lib/northbound_cli.c

index 2f6aef539866192778257b49328316efe272d7e5..ee080bca3f22f17e19f6b3be2aa7bcc0135d58f7 100644 (file)
@@ -63,7 +63,15 @@ static int nb_cli_classic_commit(struct vty *vty)
        context.user = vty;
        ret = nb_candidate_commit(&context, vty->candidate_config, true, NULL,
                                  NULL, errmsg, sizeof(errmsg));
-       if (ret != NB_OK && ret != NB_ERR_NO_CHANGES) {
+       switch (ret) {
+       case NB_OK:
+               /* Successful commit. Print warnings (if any). */
+               if (strlen(errmsg) > 0)
+                       vty_out(vty, "%s\n", errmsg);
+               break;
+       case NB_ERR_NO_CHANGES:
+               break;
+       default:
                vty_out(vty, "%% Configuration failed.\n\n");
                vty_show_nb_errors(vty, ret, errmsg);
                if (vty->t_pending_commit)
@@ -74,9 +82,7 @@ static int nb_cli_classic_commit(struct vty *vty)
                /* Regenerate candidate for consistency. */
                nb_config_replace(vty->candidate_config, running_config, true);
                return CMD_WARNING_CONFIG_FAILED;
-       } else if (strlen(errmsg) > 0)
-               /* Successful commit. Print warnings (if any). */
-               vty_out(vty, "%s\n", errmsg);
+       }
 
        return CMD_SUCCESS;
 }