You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mm...@apache.org on 2019/06/14 18:04:00 UTC

[accumulo] branch 2.0 updated: Added a catch all for dropped Client properties. (#1197)

This is an automated email from the ASF dual-hosted git repository.

mmiller pushed a commit to branch 2.0
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/2.0 by this push:
     new 0a92344  Added a catch all for dropped Client properties. (#1197)
0a92344 is described below

commit 0a9234467add049f9ddbb0ee85b1de7cacfc4c29
Author: Mike Miller <mm...@apache.org>
AuthorDate: Fri Jun 14 14:03:55 2019 -0400

    Added a catch all for dropped Client properties. (#1197)
    
    * Make ClientOps throw error and print bad options
---
 .../org/apache/accumulo/core/cli/ClientOpts.java   | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java b/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
index b07787a..c5bd00d 100644
--- a/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
+++ b/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
@@ -82,6 +82,19 @@ public class ClientOpts extends Help {
     }
   }
 
+  /**
+   * A catch all for older legacy options that have been dropped.  Most of them were replaced with
+   * accumulo-client.properties in 2.0.  Others have been dropped completely.
+   */
+  private String legacyClientOpts = "-p -tc --tokenClass -i --instance --site-file --keytab " +
+          "--debug -fake --mock --ssl --sasl";
+  @Parameter(names = {"-p", "-tc", "--tokenClass", "-i", "--instance",
+          "--site-file", "--keytab"}, hidden = true)
+  private String legacyOpts = null;
+  @Parameter(names = {"--debug", "-fake", "--mock", "--ssl",  "--sasl"}, hidden = true)
+  private boolean legacyOptsBoolean = false;
+
+
   @Parameter(names = {"-u", "--user"}, description = "Connection user")
   public String principal = null;
 
@@ -120,6 +133,17 @@ public class ClientOpts extends Help {
   @Override
   public void parseArgs(String programName, String[] args, Object... others) {
     super.parseArgs(programName, args, others);
+    if (legacyOpts != null || legacyOptsBoolean) {
+      // grab the bad options
+      StringBuilder badOptions = new StringBuilder();
+      for (String arg : args) {
+        if (legacyClientOpts.contains(arg))
+          badOptions.append(arg).append(" ");
+      }
+      throw new IllegalArgumentException("The Client options: " + badOptions.toString() +
+              "have been dropped. Use accumulo-client.properties for any connection or token " +
+              "options. See '-c, --config-file' option.");
+    }
   }
 
   private Properties cachedProps = null;