You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2015/05/14 03:06:51 UTC

[2/5] accumulo git commit: ACCUMULO-3814 Include ACCUMULO_CONF_DIR when exec'ing commands

ACCUMULO-3814 Include ACCUMULO_CONF_DIR when exec'ing commands

Makes sure things like SetGoalState will properly run.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/e622196c
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/e622196c
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/e622196c

Branch: refs/heads/master
Commit: e622196c8eda64469252683c669b1730ea8efd32
Parents: d81ef22
Author: Josh Elser <el...@apache.org>
Authored: Wed May 13 20:32:18 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed May 13 20:32:18 2015 -0400

----------------------------------------------------------------------
 .../cluster/standalone/StandaloneClusterControl.java     | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/e622196c/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
index 89027e7..029cd4c 100644
--- a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
@@ -102,11 +102,13 @@ public class StandaloneClusterControl implements ClusterControl {
   public Entry<Integer,String> execWithStdout(Class<?> clz, String[] args) throws IOException {
     File confDir = getConfDir();
     String master = getHosts(new File(confDir, "masters")).get(0);
-    String[] cmd = new String[2 + args.length];
-    cmd[0] = accumuloPath;
-    cmd[1] = clz.getName();
+    String[] cmd = new String[3 + args.length];
+    // Make sure we always set the right ACCUMULO_CONF_DIR
+    cmd[0] = ACCUMULO_CONF_DIR + confDir;
+    cmd[1] = accumuloPath;
+    cmd[2] = clz.getName();
     // Quote the arguments to prevent shell expansion
-    for (int i = 0, j = 2; i < args.length; i++, j++) {
+    for (int i = 0, j = 3; i < args.length; i++, j++) {
       cmd[j] = "'" + args[i] + "'";
     }
     log.info("Running: '{}' on {}", StringUtils.join(cmd, " "), master);
@@ -141,6 +143,7 @@ public class StandaloneClusterControl implements ClusterControl {
     File confDir = getConfDir();
     String master = getHosts(new File(confDir, "masters")).get(0);
     String[] cmd = new String[] {SUDO_CMD, "-u", user, ACCUMULO_CONF_DIR + accumuloConfDir, accumuloPath, Admin.class.getName(), "stopAll"};
+    // Directly invoke the RemoteShell
     Entry<Integer,String> pair = exec(master, cmd);
     if (0 != pair.getKey().intValue()) {
       throw new IOException("stopAll did not finish successfully, retcode=" + pair.getKey() + ", stdout=" + pair.getValue());