You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by ro...@apache.org on 2016/05/13 22:49:25 UTC

oozie git commit: OOZIE-2529 Support adding secret keys to Credentials of Launcher (satishsaley via rohini)

Repository: oozie
Updated Branches:
  refs/heads/master c715efdc0 -> 5fbd3eb3f


OOZIE-2529 Support adding secret keys to Credentials of Launcher (satishsaley via rohini)


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

Branch: refs/heads/master
Commit: 5fbd3eb3fc12e78c3087e3456a83470564264c1f
Parents: c715efd
Author: Rohini Palaniswamy <ro...@apache.org>
Authored: Fri May 13 15:49:18 2016 -0700
Committer: Rohini Palaniswamy <ro...@apache.org>
Committed: Fri May 13 15:49:18 2016 -0700

----------------------------------------------------------------------
 .../apache/oozie/action/hadoop/JavaActionExecutor.java | 13 +++++++++++++
 .../apache/oozie/action/hadoop/InsertTestToken.java    |  4 ++++
 .../oozie/action/hadoop/TestJavaActionExecutor.java    |  4 ++++
 release-log.txt                                        |  1 +
 4 files changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/5fbd3eb3/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
index ff084d1..a081e66 100644
--- a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
+++ b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
@@ -1164,6 +1164,19 @@ public class JavaActionExecutor extends ActionExecutor {
                         LOG.debug("ADDING TOKEN: " + fauxAlias);
                         launcherJobConf.getCredentials().addToken(fauxAlias, tk);
                     }
+                    if (credentialsConf.getCredentials().numberOfSecretKeys() > 0) {
+                        for (Entry<String, CredentialsProperties> entry : credentialsProperties.entrySet()) {
+                            CredentialsProperties credProps = entry.getValue();
+                            if (credProps != null) {
+                                Text credName = new Text(credProps.getName());
+                                byte[] secKey = credentialsConf.getCredentials().getSecretKey(credName);
+                                if (secKey != null) {
+                                    LOG.debug("ADDING CREDENTIAL: " + credProps.getName());
+                                    launcherJobConf.getCredentials().addSecretKey(credName, secKey);
+                                }
+                            }
+                        }
+                    }
                 }
                 else {
                     LOG.info("No need to inject credentials.");

http://git-wip-us.apache.org/repos/asf/oozie/blob/5fbd3eb3/core/src/test/java/org/apache/oozie/action/hadoop/InsertTestToken.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/action/hadoop/InsertTestToken.java b/core/src/test/java/org/apache/oozie/action/hadoop/InsertTestToken.java
index e1c439f..9da8fbe 100644
--- a/core/src/test/java/org/apache/oozie/action/hadoop/InsertTestToken.java
+++ b/core/src/test/java/org/apache/oozie/action/hadoop/InsertTestToken.java
@@ -27,6 +27,7 @@ import org.apache.oozie.util.XLog;
 
 
 public class InsertTestToken extends Credentials{
+    public static String DUMMY_SECRET_KEY = "DummySecretKey";
     public InsertTestToken() {
     }
 
@@ -39,6 +40,9 @@ public class InsertTestToken extends Credentials{
             Token<DelegationTokenIdentifier> abctoken = new Token<DelegationTokenIdentifier>();
             jobconf.getCredentials().addToken(new Text("ABC Token"), abctoken);
             XLog.getLog(getClass()).debug("Added the ABC token in job conf");
+
+            jobconf.getCredentials().addSecretKey(new Text(DUMMY_SECRET_KEY), DUMMY_SECRET_KEY.getBytes("UTF-8"));
+            XLog.getLog(getClass()).debug("Added the " + DUMMY_SECRET_KEY + " in job conf");
         }
         catch (Exception e) {
             XLog.getLog(getClass()).warn("Exception in addtoJobConf", e);

http://git-wip-us.apache.org/repos/asf/oozie/blob/5fbd3eb3/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java b/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
index d2f90c6..3dad557 100644
--- a/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
+++ b/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
@@ -980,6 +980,10 @@ public class TestJavaActionExecutor extends ActionExecutorTestCase {
         ae.setCredentialTokens(credentialsConf, context, action, credProperties);
         Token<? extends TokenIdentifier> tk = credentialsConf.getCredentials().getToken(new Text("ABC Token"));
         assertNotNull(tk);
+
+        byte[] secKey = credentialsConf.getCredentials().getSecretKey(new Text(InsertTestToken.DUMMY_SECRET_KEY));
+        assertNotNull(secKey);
+        assertEquals(InsertTestToken.DUMMY_SECRET_KEY, new String(secKey, "UTF-8"));
     }
 
     public void testCredentialsInvalid() throws Exception {

http://git-wip-us.apache.org/repos/asf/oozie/blob/5fbd3eb3/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index efd0108..412128c 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.3.0 release (trunk - unreleased)
 
+OOZIE-2529 Support adding secret keys to Credentials of Launcher (satishsaley via rohini)
 OOZIE-1402 Increase retry interval for non-progressing coordinator action with fix value (satishsaley via puru)
 OOZIE-2512 ShareLibservice returns incorrect path for jar (satishsaley via puru)
 OOZIE-2471 Show child job url tab for distcp (satishsaley via puru)