Author: jarcec
Date: Wed Apr 25 13:13:58 2012
New Revision: 1330263

URL: http://svn.apache.org/viewvc?rev=1330263&view=rev
Log:
SQOOP-453. Oozie does not work with Sqoop metastore.

(Cheolsoo Park via Jarek Jarcec Cecho)

Modified:
    sqoop/trunk/src/docs/user/saved-jobs.txt
    sqoop/trunk/src/java/org/apache/sqoop/SqoopOptions.java

Modified: sqoop/trunk/src/docs/user/saved-jobs.txt
URL: 
http://svn.apache.org/viewvc/sqoop/trunk/src/docs/user/saved-jobs.txt?rev=1330263&r1=1330262&r2=1330263&view=diff
==============================================================================
--- sqoop/trunk/src/docs/user/saved-jobs.txt (original)
+++ sqoop/trunk/src/docs/user/saved-jobs.txt Wed Apr 25 13:13:58 2012
@@ -168,6 +168,9 @@ prompted for that password each time you
 You can enable passwords in the metastore by setting
 +sqoop.metastore.client.record.password+ to +true+ in the configuration.
 
+Note that you have to set +sqoop.metastore.client.record.password+ to +true+
+if you are executing saved jobs via Oozie because Sqoop cannot prompt the user
+to enter passwords while being executed as Oozie tasks.
 
 Saved jobs and incremental imports
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Modified: sqoop/trunk/src/java/org/apache/sqoop/SqoopOptions.java
URL: 
http://svn.apache.org/viewvc/sqoop/trunk/src/java/org/apache/sqoop/SqoopOptions.java?rev=1330263&r1=1330262&r2=1330263&view=diff
==============================================================================
--- sqoop/trunk/src/java/org/apache/sqoop/SqoopOptions.java (original)
+++ sqoop/trunk/src/java/org/apache/sqoop/SqoopOptions.java Wed Apr 25 13:13:58 
2012
@@ -1029,7 +1029,19 @@ public class SqoopOptions implements Clo
    * @return the password as a string
    */
   private String securePasswordEntry() {
-    return new String(System.console().readPassword("Enter password: "));
+    try {
+      return new String(System.console().readPassword("Enter password: "));
+    } catch (NullPointerException e) {
+      LOG.error("It seems that you have launched a Sqoop metastore job via");
+      LOG.error("Oozie with sqoop.metastore.client.record.password disabled.");
+      LOG.error("But this configuration is not supported because Sqoop can't");
+      LOG.error("prompt the user to enter the password while being executed");
+      LOG.error("as Oozie tasks. Please enable sqoop.metastore.client.record");
+      LOG.error(".password in sqoop-site.xml, or provide the password");
+      LOG.error("explictly using --password in the command tag of the Oozie");
+      LOG.error("workflow file.");
+      return null;
+    }
   }
 
   /**


Reply via email to