[ovs-dev] [PATCH 10/30] ovn-nbctl: Don't die in nbctl_ls_add().
Jakub Sitnicki
jkbs at redhat.com
Sat Jul 7 11:09:44 UTC 2018
Propagate the error via the context instead.
Signed-off-by: Jakub Sitnicki <jkbs at redhat.com>
---
ovn/utilities/ovn-nbctl.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index f519c6c92..d331c93c0 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -846,7 +846,9 @@ nbctl_ls_add(struct ctl_context *ctx)
bool may_exist = shash_find(&ctx->options, "--may-exist") != NULL;
bool add_duplicate = shash_find(&ctx->options, "--add-duplicate") != NULL;
if (may_exist && add_duplicate) {
- ctl_fatal("--may-exist and --add-duplicate may not be used together");
+ ctl_error(ctx, "--may-exist and --add-duplicate may not be used "
+ "together");
+ return;
}
if (ls_name) {
@@ -857,15 +859,18 @@ nbctl_ls_add(struct ctl_context *ctx)
if (may_exist) {
return;
}
- ctl_fatal("%s: a switch with this name already exists",
- ls_name);
+ ctl_error(ctx, "%s: a switch with this name already "
+ "exists", ls_name);
+ return;
}
}
}
} else if (may_exist) {
- ctl_fatal("--may-exist requires specifying a name");
+ ctl_error(ctx, "--may-exist requires specifying a name");
+ return;
} else if (add_duplicate) {
- ctl_fatal("--add-duplicate requires specifying a name");
+ ctl_error(ctx, "--add-duplicate requires specifying a name");
+ return;
}
struct nbrec_logical_switch *ls;
--
2.14.4
More information about the dev
mailing list