You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2015/06/02 17:15:42 UTC
ambari git commit: AMBARI-11590. Kerberos: provide option to set test
account name (rlevas)
Repository: ambari
Updated Branches:
refs/heads/trunk 19f18f577 -> ed5558742
AMBARI-11590. Kerberos: provide option to set test account name (rlevas)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ed555874
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ed555874
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ed555874
Branch: refs/heads/trunk
Commit: ed5558742e4b8b88e495e0190ec1cbe04683ffe1
Parents: 19f18f5
Author: Robert Levas <rl...@hortonworks.com>
Authored: Tue Jun 2 11:15:33 2015 -0400
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Tue Jun 2 11:15:42 2015 -0400
----------------------------------------------------------------------
.../server/controller/AmbariManagementControllerImpl.java | 8 --------
.../apache/ambari/server/controller/KerberosHelperImpl.java | 9 +++++++--
.../KERBEROS/1.10.3-10/configuration/kerberos-env.xml | 8 ++++++++
.../services/KERBEROS/configuration/kerberos-env.xml | 7 +++++++
.../apache/ambari/server/controller/KerberosHelperTest.java | 7 +++++--
5 files changed, 27 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed555874/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index d327d96..af62dd4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -3235,14 +3235,6 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
List<Stage> stages = rg.getStages();
if (stages != null && !stages.isEmpty()) {
- // If this is a Kerberos service check, set the service check stage(s) to be skip-able so that
- // the clean up stages will still be triggered in the event of a failure.
- if (kerberosServiceCheck) {
- for (Stage s : stages) {
- s.setSkippable(true);
- }
- }
-
requestStageContainer.addStages(stages);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed555874/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 dc5fc75..70d08ba 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
@@ -103,9 +103,11 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -1200,14 +1202,14 @@ public class KerberosHelperImpl implements KerberosHelper {
put("principal",
new HashMap<String, Object>() {
{
- put("value", "${cluster-env/smokeuser}_${service_check_id}@${realm}");
+ put("value", "${kerberos-env/service_check_principal_name}@${realm}");
put("type", "user");
}
});
put("keytab",
new HashMap<String, Object>() {
{
- put("file", "${keytab_dir}/kerberos.service_check.${service_check_id}.keytab");
+ put("file", "${keytab_dir}/kerberos.service_check.${short_date}.keytab");
put("owner", new HashMap<String, Object>() {{
put("name", "${cluster-env/smokeuser}");
@@ -1246,6 +1248,9 @@ public class KerberosHelperImpl implements KerberosHelper {
// Set the unique service check identifier
configurations.get("").put("service_check_id", serviceCheckId);
+ // Add a short date value
+ configurations.get("").put("short_date", new SimpleDateFormat("MMddyy").format(new Date()));
+
// Iterate over the components installed on the current host to get the service and
// component-level Kerberos descriptors in order to determine which principals,
// keytab files, and configurations need to be created or updated.
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed555874/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/configuration/kerberos-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/configuration/kerberos-env.xml b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/configuration/kerberos-env.xml
index ec50f69..6d720a0 100644
--- a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/configuration/kerberos-env.xml
+++ b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/configuration/kerberos-env.xml
@@ -152,6 +152,14 @@
<value>0</value>
</property>
+ <property>
+ <name>service_check_principal_name</name>
+ <description>
+ The principal name to use when executing the Kerberos service check
+ </description>
+ <value>${cluster_name}-${short_date}</value>
+ </property>
+
<property require-input="true">
<name>create_attributes_template</name>
<description>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed555874/ambari-server/src/main/resources/stacks/HDP/2.2.GlusterFS/services/KERBEROS/configuration/kerberos-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2.GlusterFS/services/KERBEROS/configuration/kerberos-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.2.GlusterFS/services/KERBEROS/configuration/kerberos-env.xml
index 31833cb..6e698cf 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2.GlusterFS/services/KERBEROS/configuration/kerberos-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2.GlusterFS/services/KERBEROS/configuration/kerberos-env.xml
@@ -77,6 +77,13 @@
<value/>
</property>
+ <property>
+ <name>service_check_principal_name</name>
+ <description>
+ The principal name to use when executing the Kerberos service check
+ </description>
+ <value>${cluster_name}-${short_date}</value>
+ </property>
<property require-input="true">
<name>create_attributes_template</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed555874/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 684cdd4..58013e2 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
@@ -25,10 +25,12 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import java.lang.reflect.Field;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -2430,10 +2432,11 @@ public class KerberosHelperTest extends EasyMockSupport {
Assert.assertNotNull(serviceCheckID);
Assert.assertTrue(commandParamsStage.containsKey("principal_name"));
- Assert.assertEquals("${cluster-env/smokeuser}_" + serviceCheckID + "@${realm}", commandParamsStage.get("principal_name"));
+ Assert.assertEquals("${kerberos-env/service_check_principal_name}@${realm}", commandParamsStage.get("principal_name"));
Assert.assertTrue(commandParamsStage.containsKey("keytab_file"));
- Assert.assertEquals("${keytab_dir}/kerberos.service_check." + serviceCheckID + ".keytab", commandParamsStage.get("keytab_file"));
+ Assert.assertEquals("${keytab_dir}/kerberos.service_check." + new SimpleDateFormat("MMddyy").format(new Date()) + ".keytab",
+ commandParamsStage.get("keytab_file"));
}
}