ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rle...@apache.org
Subject ambari git commit: AMBARI-10016. Kerberos: Run ambari-server using non-root causes issues with AD velocity engine (rlevas)
Date Wed, 11 Mar 2015 17:45:56 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.0.0 8f85e8c60 -> 41ca3cc68


AMBARI-10016. Kerberos: Run ambari-server using non-root causes issues with AD velocity engine
(rlevas)


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

Branch: refs/heads/branch-2.0.0
Commit: 41ca3cc6872c18619d7a4978e2e4851b91ad297e
Parents: 8f85e8c
Author: Robert Levas <rlevas@hortonworks.com>
Authored: Wed Mar 11 13:45:50 2015 -0400
Committer: Robert Levas <rlevas@hortonworks.com>
Committed: Wed Mar 11 13:45:54 2015 -0400

----------------------------------------------------------------------
 .../kerberos/ADKerberosOperationHandler.java       | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/41ca3cc6/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandler.java
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandler.java
index faa813c..38a7563 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandler.java
@@ -25,7 +25,7 @@ import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.app.Velocity;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.ParseErrorException;
 import org.apache.velocity.exception.ResourceNotFoundException;
@@ -115,12 +115,6 @@ public class ADKerberosOperationHandler extends KerberosOperationHandler
{
   private SearchControls searchControls = null;
 
   /**
-   * VelocityEngine used to process the "create principal template" that is expected to generate
-   * a JSON structure declaring the attributes of the Active Directory account
-   */
-  private VelocityEngine velocityEngine = null;
-
-  /**
    * The Gson instance to use to convert the template-generated JSON structure to a Map of
attribute
    * names to values.
    */
@@ -183,9 +177,6 @@ public class ADKerberosOperationHandler extends KerberosOperationHandler
{
 
     this.createTemplate = kerberosConfiguration.get(KERBEROS_ENV_CREATE_ATTRIBUTES_TEMPLATE);
 
-    this.velocityEngine = new VelocityEngine();
-    this.velocityEngine.init();
-
     this.gson = new Gson();
 
     setOpen(true);
@@ -199,7 +190,6 @@ public class ADKerberosOperationHandler extends KerberosOperationHandler
{
   @Override
   public void close() throws KerberosOperationException {
     this.searchControls = null;
-    this.velocityEngine = null;
 
     this.gson = null;
 
@@ -515,9 +505,6 @@ public class ADKerberosOperationHandler extends KerberosOperationHandler
{
   protected Map<String, Object> processCreateTemplate(Map<String, Object> context)
       throws KerberosOperationException {
 
-    if (velocityEngine == null) {
-      throw new KerberosOperationException("The Velocity Engine must not be null");
-    }
     if (gson == null) {
       throw new KerberosOperationException("The JSON parser must not be null");
     }
@@ -543,7 +530,7 @@ public class ADKerberosOperationHandler extends KerberosOperationHandler
{
     }
 
     try {
-      if (velocityEngine.evaluate(new VelocityContext(context), stringWriter, "Active Directory
principal create template", template)) {
+      if (Velocity.evaluate(new VelocityContext(context), stringWriter, "Active Directory
principal create template", template)) {
         String json = stringWriter.toString();
         Type type = new TypeToken<Map<String, Object>>() {
         }.getType();


Mime
View raw message