sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject git commit: SQOOP-981: The --hadoop-home command line parameter is no longer accepted
Date Mon, 15 Apr 2013 17:10:32 GMT
Updated Branches:
  refs/heads/trunk f5006b600 -> 2d3341488


SQOOP-981: The --hadoop-home command line parameter is no longer accepted

(Venkat Ranganathan via Jarek Jarcec Cecho)


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

Branch: refs/heads/trunk
Commit: 2d3341488f979d19da5dee71982a1c915170e149
Parents: f5006b6
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Mon Apr 15 10:10:01 2013 -0700
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Mon Apr 15 10:10:01 2013 -0700

----------------------------------------------------------------------
 src/java/org/apache/sqoop/tool/BaseSqoopTool.java |   12 +++++++--
 src/test/com/cloudera/sqoop/TestSqoopOptions.java |   21 ++++++++++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/2d334148/src/java/org/apache/sqoop/tool/BaseSqoopTool.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/sqoop/tool/BaseSqoopTool.java b/src/java/org/apache/sqoop/tool/BaseSqoopTool.java
index c46a7b7..9417d57 100644
--- a/src/java/org/apache/sqoop/tool/BaseSqoopTool.java
+++ b/src/java/org/apache/sqoop/tool/BaseSqoopTool.java
@@ -401,6 +401,11 @@ public abstract class BaseSqoopTool extends com.cloudera.sqoop.tool.SqoopTool
{
         .withLongOpt(HADOOP_MAPRED_HOME_ARG)
         .create());
 
+    commonOpts.addOption(OptionBuilder.withArgName("hdir")
+            .hasArg().withDescription("Override $HADOOP_MAPRED_HOME_ARG")
+            .withLongOpt(HADOOP_HOME_ARG)
+            .create());
+
     // misc (common)
     commonOpts.addOption(OptionBuilder
         .withDescription("Print more information while working")
@@ -749,11 +754,12 @@ public abstract class BaseSqoopTool extends com.cloudera.sqoop.tool.SqoopTool
{
 
     applyCredentialsOptions(in, out);
 
-    if (in.hasOption(HADOOP_HOME_ARG)) {
-      out.setHadoopMapRedHome(in.getOptionValue(HADOOP_HOME_ARG));
-    }
+
     if (in.hasOption(HADOOP_MAPRED_HOME_ARG)) {
       out.setHadoopMapRedHome(in.getOptionValue(HADOOP_MAPRED_HOME_ARG));
+      // Only consider HADOOP_HOME if HADOOP_MAPRED_HOME is not set
+    } else if (in.hasOption(HADOOP_HOME_ARG)) {
+        out.setHadoopMapRedHome(in.getOptionValue(HADOOP_HOME_ARG));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/2d334148/src/test/com/cloudera/sqoop/TestSqoopOptions.java
----------------------------------------------------------------------
diff --git a/src/test/com/cloudera/sqoop/TestSqoopOptions.java b/src/test/com/cloudera/sqoop/TestSqoopOptions.java
index fcc38eb..c78cd87 100644
--- a/src/test/com/cloudera/sqoop/TestSqoopOptions.java
+++ b/src/test/com/cloudera/sqoop/TestSqoopOptions.java
@@ -357,4 +357,25 @@ public class TestSqoopOptions extends TestCase {
             connParams, in.getConnectionParams());
   }
 
+  // test that hadoop-home is accepted as an option
+  public void testHadoopHome() throws Exception {
+    String [] args = {
+      "--hadoop-home",
+      "/usr/lib/hadoop",
+    };
+
+    SqoopOptions opts = parse(args);
+    assertEquals("/usr/lib/hadoop", opts.getHadoopMapRedHome());
+  }
+
+  // test that hadoop-home is accepted as an option
+  public void testHadoopMapRedOverridesHadoopHome() throws Exception {
+	String[] args = { "--hadoop-home", "/usr/lib/hadoop-ignored",
+	  "--hadoop-mapred-home", "/usr/lib/hadoop", };
+
+	SqoopOptions opts = parse(args);
+	assertEquals("/usr/lib/hadoop", opts.getHadoopMapRedHome());
+  }
+
+
 }


Mime
View raw message