ovs-vsctl: Correctly exit on errors for non-map types in "remove" command.
authorBen Pfaff <blp@nicira.com>
Tue, 2 Sep 2014 15:35:02 +0000 (08:35 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 2 Sep 2014 16:06:46 +0000 (09:06 -0700)
Reported-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
tests/ovs-vsctl.at
utilities/ovs-vsctl.c

index 440bf1a..95f6096 100644 (file)
@@ -838,6 +838,9 @@ AT_CHECK([RUN_OVS_VSCTL([set port br1 name br2])],
 AT_CHECK([RUN_OVS_VSCTL([remove bridge br1 name br1])],
   [1], [], [ovs-vsctl: cannot modify read-only column name in table Bridge
 ], [OVS_VSCTL_CLEANUP])
+AT_CHECK([RUN_OVS_VSCTL([remove bridge br1 flood-vlans true])],
+  [1], [], [ovs-vsctl: "true" is not a valid integer
+], [OVS_VSCTL_CLEANUP])
 AT_CHECK([RUN_OVS_VSCTL([clear bridge br1 name])],
   [1], [], [ovs-vsctl: cannot modify read-only column name in table Bridge
 ], [OVS_VSCTL_CLEANUP])
index 4fcee77..f837158 100644 (file)
@@ -3528,11 +3528,15 @@ cmd_remove(struct vsctl_context *ctx)
         rm_type.n_max = UINT_MAX;
         error = ovsdb_datum_from_string(&rm, &rm_type,
                                         ctx->argv[i], ctx->symtab);
-        if (error && ovsdb_type_is_map(&rm_type)) {
-            free(error);
-            rm_type.value.type = OVSDB_TYPE_VOID;
-            die_if_error(ovsdb_datum_from_string(&rm, &rm_type,
-                                                 ctx->argv[i], ctx->symtab));
+        if (error) {
+            if (ovsdb_type_is_map(&rm_type)) {
+                rm_type.value.type = OVSDB_TYPE_VOID;
+                free(error);
+                die_if_error(ovsdb_datum_from_string(
+                                 &rm, &rm_type, ctx->argv[i], ctx->symtab));
+            } else {
+                vsctl_fatal("%s", error);
+            }
         }
         ovsdb_datum_subtract(&old, type, &rm, &rm_type);
         ovsdb_datum_destroy(&rm, &rm_type);