ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [50/55] [abbrv] ambari git commit: AMBARI-18804. Manage Ambari principals should be set to off when upgrading Ambari from versions < 2.4.0 (rlevas)
Date Mon, 07 Nov 2016 20:52:13 GMT
AMBARI-18804. Manage Ambari principals should be set to off when upgrading Ambari from versions
< 2.4.0 (rlevas)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: a17c3ed2f285df3c974c6fc5002e5ad728e45a56
Parents: d99df76
Author: Robert Levas <rlevas@hortonworks.com>
Authored: Mon Nov 7 12:35:42 2016 -0500
Committer: Robert Levas <rlevas@hortonworks.com>
Committed: Mon Nov 7 12:35:42 2016 -0500

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog240.java       | 20 +++++++++-----------
 .../server/upgrade/UpgradeCatalog240Test.java   |  6 ++++++
 2 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a17c3ed2/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
index 54afd8d..c113fff 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
@@ -19,8 +19,6 @@
 package org.apache.ambari.server.upgrade;
 
 import com.google.common.collect.Lists;
-import com.google.common.reflect.TypeToken;
-import com.google.gson.Gson;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
@@ -48,7 +46,6 @@ import org.apache.ambari.server.orm.dao.ResourceTypeDAO;
 import org.apache.ambari.server.orm.dao.RoleAuthorizationDAO;
 import org.apache.ambari.server.orm.dao.UserDAO;
 import org.apache.ambari.server.orm.dao.ViewInstanceDAO;
-import org.apache.ambari.server.orm.dao.WidgetDAO;
 import org.apache.ambari.server.orm.entities.AlertDefinitionEntity;
 import org.apache.ambari.server.orm.entities.ArtifactEntity;
 import org.apache.ambari.server.orm.entities.ClusterEntity;
@@ -64,7 +61,6 @@ import org.apache.ambari.server.orm.entities.RoleAuthorizationEntity;
 import org.apache.ambari.server.orm.entities.UserEntity;
 import org.apache.ambari.server.orm.entities.ViewEntityEntity;
 import org.apache.ambari.server.orm.entities.ViewInstanceEntity;
-import org.apache.ambari.server.orm.entities.WidgetEntity;
 import org.apache.ambari.server.security.authorization.ResourceType;
 import org.apache.ambari.server.security.authorization.User;
 import org.apache.ambari.server.security.authorization.Users;
@@ -87,8 +83,6 @@ import org.apache.ambari.server.state.kerberos.KerberosIdentityDescriptor;
 import org.apache.ambari.server.state.kerberos.KerberosKeytabDescriptor;
 import org.apache.ambari.server.state.kerberos.KerberosPrincipalDescriptor;
 import org.apache.ambari.server.state.kerberos.KerberosServiceDescriptor;
-import org.apache.ambari.server.state.stack.WidgetLayout;
-import org.apache.ambari.server.state.stack.WidgetLayoutInfo;
 import org.apache.ambari.server.view.DefaultMasker;
 import org.apache.ambari.view.ClusterType;
 import org.apache.ambari.view.MaskException;
@@ -100,9 +94,6 @@ import org.springframework.jdbc.support.JdbcUtils;
 import javax.persistence.EntityManager;
 import javax.persistence.Query;
 import javax.persistence.TypedQuery;
-import java.io.File;
-import java.io.FileReader;
-import java.lang.reflect.Type;
 import java.sql.Clob;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -2256,10 +2247,17 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
       // Update the kerberos-env properties to change kdc_host to kdc_hosts
       config = cluster.getDesiredConfigByType("kerberos-env");
       if (config != null) {
+        Map<String, String> updates = new HashMap<String, String>();
+        Set<String> removes = new HashSet<String>();
+
         // Rename kdc_host to kdc_hosts
         String value = config.getProperties().get("kdc_host");
-        Map<String, String> updates = Collections.singletonMap("kdc_hosts", value);
-        Set<String> removes = Collections.singleton("kdc_host");
+        updates.put("kdc_hosts", value);
+        removes.add("kdc_host");
+
+        // Ensure create_ambari_principal is set to "false" since it is expected that Ambari's
+        // principal, keytab file, and JAAS file has already been manually configured.
+        updates.put("create_ambari_principal", "false");
 
         updateConfigurationPropertiesForCluster(cluster, "kerberos-env", updates, removes,
true, false);
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a17c3ed2/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
index 958758f..a674470 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
@@ -1607,10 +1607,13 @@ public class UpgradeCatalog240Test {
     Assert.assertNotNull(capturedCRProperties);
     Assert.assertFalse(capturedCRProperties.containsKey("kdc_host"));
     Assert.assertTrue(capturedCRProperties.containsKey("kdc_hosts"));
+    Assert.assertTrue(capturedCRProperties.containsKey("create_ambari_principal"));
 
     for (String property : propertiesKerberosEnv.keySet()) {
       if ("kdc_host".equals(property)) {
         Assert.assertEquals(property, propertiesKerberosEnv.get(property), capturedCRProperties.get("kdc_hosts"));
+      } else if ("create_ambari_principal".equals(property)) {
+        Assert.assertEquals(property, propertiesKerberosEnv.get(property), "false");
       } else {
         Assert.assertEquals(property, propertiesKerberosEnv.get(property), capturedCRProperties.get(property));
       }
@@ -1739,10 +1742,13 @@ public class UpgradeCatalog240Test {
     Assert.assertNotNull(capturedCRProperties);
     Assert.assertFalse(capturedCRProperties.containsKey("kdc_host"));
     Assert.assertTrue(capturedCRProperties.containsKey("kdc_hosts"));
+    Assert.assertTrue(capturedCRProperties.containsKey("create_ambari_principal"));
 
     for (String property : propertiesKerberosEnv.keySet()) {
       if ("kdc_host".equals(property)) {
         Assert.assertEquals(property, propertiesKerberosEnv.get(property), capturedCRProperties.get("kdc_hosts"));
+      } else if ("create_ambari_principal".equals(property)) {
+        Assert.assertEquals(property, propertiesKerberosEnv.get(property), "false");
       } else {
         Assert.assertEquals(property, propertiesKerberosEnv.get(property), capturedCRProperties.get(property));
       }


Mime
View raw message