diff options
| author | Quentin Young <qlyoung@users.noreply.github.com> | 2020-08-31 14:03:25 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-31 14:03:25 -0400 |
| commit | ddffdcf728280246e4ba8ba645d3c1b98763c4e5 (patch) | |
| tree | 74614355458995ddb41291d0f16e141a941f5c9b | |
| parent | 48a1bbdf76ed74510a8d78c5d736dfa8c85e9e59 (diff) | |
| parent | 1bd43069091b841b239d9a0c9139a762eae424b0 (diff) | |
Merge pull request #7025 from opensourcerouting/silence-cli-warning
lib: silence overly verbose CLI warning
| -rw-r--r-- | lib/northbound_cli.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index 2f6aef5398..ee080bca3f 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -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; } |
