X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=utilities%2Fovs-vsctl.c;h=733536894a73295645be10cc4bc085c01b736a3e;hb=898b7f8d4131c9dae8d292bfacd99465fb52b26c;hp=dcc4927a5f7a18dc2aa8777e6d0d8a2613100e9d;hpb=c29a8ba8868d55026e9f4b0f88582fd85da48621;p=openvswitch diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index dcc4927a..73353689 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -1560,7 +1560,6 @@ static const struct vsctl_column open_vswitch_columns[] = { {&ovsrec_open_vswitch_col_bridges, VSCF_READONLY, NULL}, {&ovsrec_open_vswitch_col_controller, VSCF_READONLY, NULL}, {&ovsrec_open_vswitch_col_cur_cfg, VSCF_HIDDEN, NULL}, - {&ovsrec_open_vswitch_col_management_id, 0, "[0-9a-fA-F]{12}"}, {&ovsrec_open_vswitch_col_managers, 0, "p?(ssl|tcp|unix):.*"}, {&ovsrec_open_vswitch_col_next_cfg, VSCF_HIDDEN, NULL}, {&ovsrec_open_vswitch_col_ssl, VSCF_READONLY, NULL}, @@ -1931,6 +1930,7 @@ error: static void cmd_get(struct vsctl_context *ctx) { + bool if_exists = shash_find(&ctx->options, "--if-exists"); const char *table_name = ctx->argv[1]; const char *record_id = ctx->argv[2]; const struct vsctl_table_class *table; @@ -1965,14 +1965,15 @@ cmd_get(struct vsctl_context *ctx) idx = ovsdb_datum_find_key(&datum, &key, column->idl->type.key_type); if (idx == UINT_MAX) { - ovs_fatal(0, "no key %s in %s record \"%s\" column %s", - key_string, table_name, record_id, - column->idl->name); - + if (!if_exists) { + ovs_fatal(0, "no key \"%s\" in %s record \"%s\" column %s", + key_string, table->class->name, record_id, + column->idl->name); + } + } else { + ovsdb_atom_to_string(&datum.values[idx], + column->idl->type.value_type, out); } - ovsdb_atom_to_string(&datum.values[idx], - column->idl->type.value_type, out); - ovsdb_atom_destroy(&key, column->idl->type.key_type); } else { ovsdb_datum_to_string(&datum, &column->idl->type, out); @@ -2607,7 +2608,7 @@ static const struct vsctl_command_syntax all_commands[] = { {"set-ssl", 3, 3, cmd_set_ssl, NULL, "--bootstrap"}, /* Parameter commands. */ - {"get", 3, INT_MAX, cmd_get, NULL, ""}, + {"get", 3, INT_MAX, cmd_get, NULL, "--if-exists"}, {"list", 1, INT_MAX, cmd_list, NULL, ""}, {"set", 3, INT_MAX, cmd_set, NULL, "--force"}, {"add", 4, INT_MAX, cmd_add, NULL, "--force"},