hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject svn commit: r1479714 - in /hbase/branches/0.95: hbase-it/src/test/java/org/apache/hadoop/hbase/HBaseClusterManager.java src/main/docbkx/developer.xml
Date Mon, 06 May 2013 23:08:52 GMT
Author: sershe
Date: Mon May  6 23:08:51 2013
New Revision: 1479714

URL: http://svn.apache.org/r1479714
Log:
HBASE-8405 Add more custom options to how ClusterManager runs commands REDO DIFFERENTLY

Modified:
    hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/HBaseClusterManager.java
    hbase/branches/0.95/src/main/docbkx/developer.xml

Modified: hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/HBaseClusterManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/HBaseClusterManager.java?rev=1479714&r1=1479713&r2=1479714&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/HBaseClusterManager.java
(original)
+++ hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/HBaseClusterManager.java
Mon May  6 23:08:51 2013
@@ -40,7 +40,13 @@ import org.apache.hadoop.util.Shell;
 public class HBaseClusterManager extends ClusterManager {
   private String sshUserName;
   private String sshOptions;
-  private String sshBeforeCommand;
+
+  /**
+   * The command format that is used to execute the remote command. Arguments:
+   * 1 SSH options, 2 user name , 3 "@" if username is set, 4 host, 5 original command.
+   */
+  private static final String DEFAULT_TUNNEL_CMD = "/usr/bin/ssh %1$s %2$s%3$s%4$s \"%5$s\"";
+  private String tunnelCmd;
 
   @Override
   public void setConf(Configuration conf) {
@@ -55,10 +61,8 @@ public class HBaseClusterManager extends
     if (!extraSshOptions.isEmpty()) {
       sshOptions = StringUtils.join(new Object[] { sshOptions, extraSshOptions }, " ");
     }
-    sshBeforeCommand =  conf.get("hbase.it.clustermanager.ssh.beforeCommand", "");
-    if (!sshBeforeCommand.isEmpty()) {
-      sshBeforeCommand += " && ";
-    }
+    sshOptions = (sshOptions == null) ? "" : sshOptions;
+    tunnelCmd = conf.get("hbase.it.clustermanager.ssh.cmd", DEFAULT_TUNNEL_CMD);
     LOG.info("Running with SSH user [" + sshUserName + "] and options [" + sshOptions + "]");
   }
 
@@ -68,8 +72,6 @@ public class HBaseClusterManager extends
   protected class RemoteShell extends Shell.ShellCommandExecutor {
     private String hostname;
 
-    private String sshCmd = "/usr/bin/ssh";
-
     public RemoteShell(String hostname, String[] execString, File dir, Map<String, String>
env,
         long timeout) {
       super(execString, dir, env, timeout);
@@ -93,14 +95,11 @@ public class HBaseClusterManager extends
 
     @Override
     public String[] getExecString() {
-      String userAndHost = sshUserName.isEmpty() ? hostname : (sshUserName + "@" + hostname);
-      return new String[] {
-          "bash", "-c",
-          StringUtils.join(new String[] { sshCmd,
-              (sshOptions == null) ? "" : sshOptions,
-              userAndHost,
-              "\"" + sshBeforeCommand + StringUtils.join(super.getExecString(), " ") + "\""
-          }, " ")};
+      String at = sshUserName.isEmpty() ? "" : "@";
+      String remoteCmd = StringUtils.join(super.getExecString(), " ");
+      String cmd = String.format(tunnelCmd, sshOptions, sshUserName, at, hostname, remoteCmd);
+      LOG.info("Executing full command [" + cmd + "]");
+      return new String[] { "/usr/bin/env", "bash", "-c", cmd };
     }
 
     @Override

Modified: hbase/branches/0.95/src/main/docbkx/developer.xml
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/src/main/docbkx/developer.xml?rev=1479714&r1=1479713&r2=1479714&view=diff
==============================================================================
Binary files - no diff available.



Mime
View raw message