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-11795. Service configs are not updated with enabling Kerberos unless the service has identities to process (rlevas)
Date Tue, 09 Jun 2015 12:41:55 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b5f4872ae -> 529ec1026


AMBARI-11795. Service configs are not updated with enabling Kerberos unless the service has
identities to process (rlevas)


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

Branch: refs/heads/trunk
Commit: 529ec1026ffeda69ba4f34febc05655be5ee10fd
Parents: b5f4872
Author: Robert Levas <rlevas@hortonworks.com>
Authored: Tue Jun 9 08:41:48 2015 -0400
Committer: Robert Levas <rlevas@hortonworks.com>
Committed: Tue Jun 9 08:42:00 2015 -0400

----------------------------------------------------------------------
 .../server/controller/KerberosHelperImpl.java   |  17 +---
 .../AbstractPrepareKerberosServerAction.java    |   8 +-
 .../PrepareDisableKerberosServerAction.java     |   2 +-
 .../PrepareEnableKerberosServerAction.java      |   2 +-
 .../PrepareKerberosIdentitiesServerAction.java  |   2 +-
 .../server/controller/KerberosHelperTest.java   | 101 -------------------
 6 files changed, 9 insertions(+), 123 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/529ec102/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
index 8a5d4fd..94de899 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
@@ -480,22 +480,9 @@ public class KerberosHelperImpl implements KerberosHelper {
 
                 if (serviceDescriptor != null) {
                   // If there is no filter or the filter contains the current component name,
-                  // test to see if this component should be process by querying the handler...
+                  // test to see if this component should be processed by querying the handler...
                   if (((componentFilter == null) || componentFilter.contains(componentName))
&& shouldProcessCommand.invoke(sch)) {
-                    KerberosComponentDescriptor componentDescriptor = serviceDescriptor.getComponent(componentName);
-                    int identities = 0;
-
-                    // Add service-level principals (and keytabs)
-                    identities += filteredIdentitiesCount(serviceDescriptor.getIdentities(false),
identityFilter);
-
-                    if (componentDescriptor != null) {
-                      // Add component-level principals (and keytabs)
-                      identities += filteredIdentitiesCount(componentDescriptor.getIdentities(false),
identityFilter);
-                    }
-
-                    if (identities > 0) {
-                      serviceComponentHostsToProcess.add(sch);
-                    }
+                    serviceComponentHostsToProcess.add(sch);
                   }
                 }
               }

http://git-wip-us.apache.org/repos/asf/ambari/blob/529ec102/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
index b3b6b48..479a054 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
@@ -59,11 +59,11 @@ public abstract class AbstractPrepareKerberosServerAction extends KerberosServer
     throw new UnsupportedOperationException();
   }
 
-  protected void processIdentities(Cluster cluster, KerberosDescriptor kerberosDescriptor,
List<ServiceComponentHost> schToProcess,
-                                   Collection<String> identityFilter, String dataDirectory,
-                                   Map<String, Map<String, String>> kerberosConfigurations)
throws AmbariException {
+  protected void processServiceComponentHosts(Cluster cluster, KerberosDescriptor kerberosDescriptor,
List<ServiceComponentHost> schToProcess,
+                                              Collection<String> identityFilter, String
dataDirectory,
+                                              Map<String, Map<String, String>>
kerberosConfigurations) throws AmbariException {
 
-    actionLog.writeStdOut("Processing Kerberos Identities");
+    actionLog.writeStdOut("Processing Kerberos identities and configurations");
 
     if (!schToProcess.isEmpty()) {
       if(dataDirectory == null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/529ec102/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java
index 68fcca0..4315f78 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java
@@ -112,7 +112,7 @@ public class PrepareDisableKerberosServerAction extends AbstractPrepareKerberosS
       actionLog.writeStdOut(String.format("Processing %d components", schCount));
     }
 
-    processIdentities(cluster, kerberosDescriptor, schToProcess, identityFilter, dataDirectory,
kerberosConfigurations);
+    processServiceComponentHosts(cluster, kerberosDescriptor, schToProcess, identityFilter,
dataDirectory, kerberosConfigurations);
 
     actionLog.writeStdOut("Determining configuration changes");
     // Ensure the cluster-env/security_enabled flag is set properly

http://git-wip-us.apache.org/repos/asf/ambari/blob/529ec102/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareEnableKerberosServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareEnableKerberosServerAction.java
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareEnableKerberosServerAction.java
index 2295eeb..9caf7df 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareEnableKerberosServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareEnableKerberosServerAction.java
@@ -104,7 +104,7 @@ public class PrepareEnableKerberosServerAction extends AbstractPrepareKerberosSe
       actionLog.writeStdOut(String.format("Processing %d components", schCount));
     }
 
-    processIdentities(cluster, kerberosDescriptor, schToProcess, identityFilter, dataDirectory,
kerberosConfigurations);
+    processServiceComponentHosts(cluster, kerberosDescriptor, schToProcess, identityFilter,
dataDirectory, kerberosConfigurations);
 
     if (!schToProcess.isEmpty()) {
       actionLog.writeStdOut("Creating auth-to-local rules");

http://git-wip-us.apache.org/repos/asf/ambari/blob/529ec102/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareKerberosIdentitiesServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareKerberosIdentitiesServerAction.java
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareKerberosIdentitiesServerAction.java
index e39d868..55f75ad 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareKerberosIdentitiesServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareKerberosIdentitiesServerAction.java
@@ -97,7 +97,7 @@ public class PrepareKerberosIdentitiesServerAction extends AbstractPrepareKerber
       actionLog.writeStdOut(String.format("Processing %d components", schCount));
     }
 
-    processIdentities(cluster, kerberosDescriptor, schToProcess, identityFilter, dataDirectory,
kerberosConfigurations);
+    processServiceComponentHosts(cluster, kerberosDescriptor, schToProcess, identityFilter,
dataDirectory, kerberosConfigurations);
 
 
     return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", actionLog.getStdOut(),
actionLog.getStdErr());

http://git-wip-us.apache.org/repos/asf/ambari/blob/529ec102/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
index f8ba840..e056ee3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
@@ -19,10 +19,8 @@
 package org.apache.ambari.server.controller;
 
 import static org.easymock.EasyMock.*;
-import static org.easymock.EasyMock.createStrictMock;
 import static org.junit.Assert.*;
 
-import java.io.File;
 import java.lang.reflect.Field;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -59,7 +57,6 @@ import org.apache.ambari.server.metadata.RoleCommandOrder;
 import org.apache.ambari.server.orm.DBAccessor;
 import org.apache.ambari.server.security.SecurityHelper;
 import org.apache.ambari.server.serveraction.kerberos.KDCType;
-import org.apache.ambari.server.serveraction.kerberos.KerberosConfigDataFileWriter;
 import org.apache.ambari.server.serveraction.kerberos.KerberosConfigDataFileWriterFactory;
 import org.apache.ambari.server.serveraction.kerberos.KerberosCredential;
 import org.apache.ambari.server.serveraction.kerberos.KerberosInvalidConfigurationException;
@@ -996,29 +993,9 @@ public class KerberosHelperTest extends EasyMockSupport {
         .andReturn(createMock(RoleCommandOrder.class))
         .once();
 
-    final KerberosIdentityDescriptor identityDescriptor1 = createMock(KerberosIdentityDescriptor.class);
-
-    final KerberosIdentityDescriptor identityDescriptor2 = createMock(KerberosIdentityDescriptor.class);
-
-    final KerberosComponentDescriptor componentDescriptor1 = createMock(KerberosComponentDescriptor.class);
-    expect(componentDescriptor1.getIdentities(false)).
-        andReturn(new ArrayList<KerberosIdentityDescriptor>() {{
-          add(identityDescriptor1);
-        }}).once();
-
-    final KerberosComponentDescriptor componentDescriptor2 = createMock(KerberosComponentDescriptor.class);
-    expect(componentDescriptor2.getIdentities(false)).
-        andReturn(new ArrayList<KerberosIdentityDescriptor>() {{
-          add(identityDescriptor2);
-        }}).once();
-
     final KerberosServiceDescriptor serviceDescriptor1 = createMock(KerberosServiceDescriptor.class);
-    expect(serviceDescriptor1.getComponent("COMPONENT1")).andReturn(componentDescriptor1).once();
-    expect(serviceDescriptor1.getIdentities(false)).andReturn(null).once();
 
     final KerberosServiceDescriptor serviceDescriptor2 = createMock(KerberosServiceDescriptor.class);
-    expect(serviceDescriptor2.getComponent("COMPONENT2")).andReturn(componentDescriptor2).once();
-    expect(serviceDescriptor2.getIdentities(false)).andReturn(null).once();
 
     final KerberosDescriptor kerberosDescriptor = createMock(KerberosDescriptor.class);
     expect(kerberosDescriptor.getService("KERBEROS")).andReturn(null).once();
@@ -1227,29 +1204,9 @@ public class KerberosHelperTest extends EasyMockSupport {
         .andReturn(createMock(RoleCommandOrder.class))
         .once();
 
-    final KerberosIdentityDescriptor identityDescriptor1 = createMock(KerberosIdentityDescriptor.class);
-
-    final KerberosIdentityDescriptor identityDescriptor2 = createMock(KerberosIdentityDescriptor.class);
-
-    final KerberosComponentDescriptor componentDescriptor1 = createMock(KerberosComponentDescriptor.class);
-    expect(componentDescriptor1.getIdentities(false)).
-        andReturn(new ArrayList<KerberosIdentityDescriptor>() {{
-          add(identityDescriptor1);
-        }}).once();
-
-    final KerberosComponentDescriptor componentDescriptor2 = createMock(KerberosComponentDescriptor.class);
-    expect(componentDescriptor2.getIdentities(false)).
-        andReturn(new ArrayList<KerberosIdentityDescriptor>() {{
-          add(identityDescriptor2);
-        }}).once();
-
     final KerberosServiceDescriptor serviceDescriptor1 = createMock(KerberosServiceDescriptor.class);
-    expect(serviceDescriptor1.getComponent("COMPONENT1")).andReturn(componentDescriptor1).once();
-    expect(serviceDescriptor1.getIdentities(false)).andReturn(null).times(1);
 
     final KerberosServiceDescriptor serviceDescriptor2 = createMock(KerberosServiceDescriptor.class);
-    expect(serviceDescriptor2.getComponent("COMPONENT2")).andReturn(componentDescriptor2).once();
-    expect(serviceDescriptor2.getIdentities(false)).andReturn(null).times(1);
 
     final KerberosDescriptor kerberosDescriptor = createMock(KerberosDescriptor.class);
     expect(kerberosDescriptor.getService("KERBEROS")).andReturn(null).once();
@@ -1472,29 +1429,9 @@ public class KerberosHelperTest extends EasyMockSupport {
         .andReturn(createMock(RoleCommandOrder.class))
         .once();
 
-    final KerberosIdentityDescriptor identityDescriptor1 = createMock(KerberosIdentityDescriptor.class);
-
-    final KerberosIdentityDescriptor identityDescriptor2 = createMock(KerberosIdentityDescriptor.class);
-
-    final KerberosComponentDescriptor componentDescriptor1 = createMock(KerberosComponentDescriptor.class);
-    expect(componentDescriptor1.getIdentities(false)).
-        andReturn(new ArrayList<KerberosIdentityDescriptor>() {{
-          add(identityDescriptor1);
-        }}).once();
-
-    final KerberosComponentDescriptor componentDescriptor2 = createMock(KerberosComponentDescriptor.class);
-    expect(componentDescriptor2.getIdentities(false)).
-        andReturn(new ArrayList<KerberosIdentityDescriptor>() {{
-          add(identityDescriptor2);
-        }}).once();
-
     final KerberosServiceDescriptor serviceDescriptor1 = createMock(KerberosServiceDescriptor.class);
-    expect(serviceDescriptor1.getComponent("COMPONENT1")).andReturn(componentDescriptor1).once();
-    expect(serviceDescriptor1.getIdentities(false)).andReturn(null).once();
 
     final KerberosServiceDescriptor serviceDescriptor2 = createMock(KerberosServiceDescriptor.class);
-    expect(serviceDescriptor2.getComponent("COMPONENT2")).andReturn(componentDescriptor2).once();
-    expect(serviceDescriptor2.getIdentities(false)).andReturn(null).once();
 
     final KerberosDescriptor kerberosDescriptor = createMock(KerberosDescriptor.class);
     expect(kerberosDescriptor.getService("KERBEROS")).andReturn(null).once();
@@ -2018,30 +1955,9 @@ public class KerberosHelperTest extends EasyMockSupport {
     expect(identityDescriptor3.getPrincipalDescriptor()).andReturn(principalDescriptor3).anyTimes();
     expect(identityDescriptor3.getKeytabDescriptor()).andReturn(keytabDescriptor3).anyTimes();
 
-    final ArrayList<KerberosIdentityDescriptor> identityDescriptors1 = new ArrayList<KerberosIdentityDescriptor>()
{{
-      add(identityDescriptor1a);
-      add(identityDescriptor1b);
-    }};
-    final KerberosComponentDescriptor componentDescriptor1 = createStrictMock(KerberosComponentDescriptor.class);
-    expect(componentDescriptor1.getIdentities(false)).andReturn(identityDescriptors1).times(3);
-
-    final ArrayList<KerberosIdentityDescriptor> identityDescriptors3 = new ArrayList<KerberosIdentityDescriptor>()
{{
-      add(identityDescriptor3);
-    }};
-    final KerberosComponentDescriptor componentDescriptor3 = createStrictMock(KerberosComponentDescriptor.class);
-    expect(componentDescriptor3.getIdentities(false)).andReturn(identityDescriptors3).times(1);
-
     final KerberosServiceDescriptor serviceDescriptor1 = createMock(KerberosServiceDescriptor.class);
-    expect(serviceDescriptor1.getIdentities(false)).andReturn(null).times(1);
-    expect(serviceDescriptor1.getComponent("COMPONENT1")).andReturn(componentDescriptor1).times(1);
-    expect(serviceDescriptor1.getIdentities(false)).andReturn(null).times(1);
-    expect(serviceDescriptor1.getComponent("COMPONENT1")).andReturn(componentDescriptor1).times(1);
-    expect(serviceDescriptor1.getIdentities(false)).andReturn(null).times(1);
-    expect(serviceDescriptor1.getComponent("COMPONENT1")).andReturn(componentDescriptor1).times(1);
 
     final KerberosServiceDescriptor serviceDescriptor3 = createMock(KerberosServiceDescriptor.class);
-    expect(serviceDescriptor3.getIdentities(false)).andReturn(null).times(1);
-    expect(serviceDescriptor3.getComponent("COMPONENT3")).andReturn(componentDescriptor3).times(1);
 
     final KerberosDescriptor kerberosDescriptor = createStrictMock(KerberosDescriptor.class);
     expect(kerberosDescriptor.getService("SERVICE1")).andReturn(serviceDescriptor1).times(1);
@@ -2253,26 +2169,9 @@ public class KerberosHelperTest extends EasyMockSupport {
     expect(identityDescriptor3.getPrincipalDescriptor()).andReturn(principalDescriptor3).anyTimes();
     expect(identityDescriptor3.getKeytabDescriptor()).andReturn(keytabDescriptor3).anyTimes();
 
-    final ArrayList<KerberosIdentityDescriptor> identityDescriptors1 = new ArrayList<KerberosIdentityDescriptor>()
{{
-      add(identityDescriptor1a);
-      add(identityDescriptor1b);
-    }};
-    final KerberosComponentDescriptor componentDescriptor1 = createStrictMock(KerberosComponentDescriptor.class);
-    expect(componentDescriptor1.getIdentities(false)).andReturn(identityDescriptors1).times(1);
-
-    final ArrayList<KerberosIdentityDescriptor> identityDescriptors3 = new ArrayList<KerberosIdentityDescriptor>()
{{
-      add(identityDescriptor3);
-    }};
-    final KerberosComponentDescriptor componentDescriptor3 = createStrictMock(KerberosComponentDescriptor.class);
-    expect(componentDescriptor3.getIdentities(false)).andReturn(identityDescriptors3).times(1);
-
     final KerberosServiceDescriptor serviceDescriptor1 = createMock(KerberosServiceDescriptor.class);
-    expect(serviceDescriptor1.getIdentities(false)).andReturn(null).times(1);
-    expect(serviceDescriptor1.getComponent("COMPONENT1")).andReturn(componentDescriptor1).times(1);
 
     final KerberosServiceDescriptor serviceDescriptor3 = createMock(KerberosServiceDescriptor.class);
-    expect(serviceDescriptor3.getIdentities(false)).andReturn(null).times(1);
-    expect(serviceDescriptor3.getComponent("COMPONENT3")).andReturn(componentDescriptor3).times(1);
 
     final KerberosDescriptor kerberosDescriptor = createStrictMock(KerberosDescriptor.class);
     expect(kerberosDescriptor.getService("SERVICE1")).andReturn(serviceDescriptor1).times(1);


Mime
View raw message