aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utilities/ovs-vsctl.8.in5
-rw-r--r--utilities/ovs-vsctl.c11
2 files changed, 16 insertions, 0 deletions
diff --git a/utilities/ovs-vsctl.8.in b/utilities/ovs-vsctl.8.in
index 0b3e164e..fcfec024 100644
--- a/utilities/ovs-vsctl.8.in
+++ b/utilities/ovs-vsctl.8.in
@@ -596,6 +596,11 @@ For a map column, without \fB\-\-if\-exists\fR it is an error if
If \fB@\fIname\fR is specified, then the UUID for \fIrecord\fR may be
referred to by that name later in the same \fBovs\-vsctl\fR
invocation in contexts where a UUID is expected.
+.IP
+Both \fB\-\-id\fR and the \fIcolumn\fR arguments are optional, but
+usually at least one or the other should be specified. If both are
+omitted, then \fBget\fR has no effect except to verify that
+\fIrecord\fR exists in \fItable\fR.
.
.IP "\fBset \fItable record column\fR[\fB:\fIkey\fR]\fB=\fIvalue\fR..."
Sets the value of each specified \fIcolumn\fR in the given
diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index 2c1ba6df..6c2fbece 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -26,6 +26,7 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "command-line.h"
#include "compiler.h"
@@ -2547,10 +2548,20 @@ pre_parse_column_key_value(struct vsctl_context *ctx,
static void
pre_cmd_get(struct vsctl_context *ctx)
{
+ const char *id = shash_find_data(&ctx->options, "--id");
const char *table_name = ctx->argv[1];
const struct vsctl_table_class *table;
int i;
+ /* Using "get" without --id or a column name could possibly make sense.
+ * Maybe, for example, a ovs-vsctl run wants to assert that a row exists.
+ * But it is unlikely that an interactive user would want to do that, so
+ * issue a warning if we're running on a terminal. */
+ if (!id && ctx->argc <= 3 && isatty(STDOUT_FILENO)) {
+ VLOG_WARN("\"get\" command without row arguments or \"--id\" is "
+ "possibly erroneous");
+ }
+
table = pre_get_table(ctx, table_name);
for (i = 3; i < ctx->argc; i++) {
if (!strcasecmp(ctx->argv[i], "_uuid")