You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rk...@apache.org on 2017/02/01 09:17:59 UTC

[2/2] ambari git commit: AMBARI-19740 Ambari upgrade to Ambari 2.5 causes start DB check failure on Zeppelin configs (r-kamath)

AMBARI-19740 Ambari upgrade to Ambari 2.5 causes start DB check failure on Zeppelin configs (r-kamath)


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

Branch: refs/heads/trunk
Commit: 8ece8aa6cd91f3abad4f1ec3c72a5320fb1278cc
Parents: 0dfe8b6
Author: Renjith Kamath <re...@gmail.com>
Authored: Wed Feb 1 14:46:43 2017 +0530
Committer: Renjith Kamath <re...@gmail.com>
Committed: Wed Feb 1 14:46:43 2017 +0530

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog250.java       | 27 ++++++++++++++++++++
 .../server/upgrade/UpgradeCatalog250Test.java   |  5 ++++
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8ece8aa6/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
index 6c90262..71cde7e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
@@ -164,6 +164,7 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
     updateTEZInteractiveConfigs();
     updateHiveLlapConfigs();
     updateTablesForZeppelinViewRemoval();
+    updateZeppelinConfigs();
     updateAtlasConfigs();
     updateLogSearchConfigs();
     updateAmbariInfraConfigs();
@@ -351,6 +352,32 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
     dbAccessor.executeQuery("DELETE from viewparameter WHERE view_name='ZEPPELIN{1.0.0}'", true);
   }
 
+  /**
+   * Updates Zeppelin configs.
+   *
+   * @throws AmbariException
+   */
+  protected void updateZeppelinConfigs() throws AmbariException {
+    AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class);
+    Clusters clusters = ambariManagementController.getClusters();
+    if (clusters != null) {
+      Map<String, Cluster> clusterMap = clusters.getClusters();
+
+      if (clusterMap != null && !clusterMap.isEmpty()) {
+        for (final Cluster cluster : clusterMap.values()) {
+          Config zeppelinEnvProperties = cluster.getDesiredConfigByType("zeppelin-env");
+          if (zeppelinEnvProperties != null) {
+            String log4jPropertiesContent = zeppelinEnvProperties.getProperties().get("log4j_properties_content");
+            String shiroIniContent = zeppelinEnvProperties.getProperties().get("shiro_ini_content");
+
+            updateConfigurationProperties("zeppelin-log4j-properties", Collections.singletonMap("log4j_properties_content", log4jPropertiesContent), true, true);
+            updateConfigurationProperties("zeppelin-shiro-ini", Collections.singletonMap("shiro_ini_content", shiroIniContent), true, true);
+          }
+        }
+      }
+    }
+  }
+
   protected String updateAmsEnvContent(String content) {
     if (content == null) {
       return null;

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ece8aa6/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
index 725928b..1cabe47 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
@@ -281,6 +281,7 @@ public class UpgradeCatalog250Test {
     Method addManageServiceAutoStartPermissions = UpgradeCatalog250.class.getDeclaredMethod("addManageServiceAutoStartPermissions");
     Method addNewConfigurationsFromXml = AbstractUpgradeCatalog.class.getDeclaredMethod("addNewConfigurationsFromXml");
     Method updateTablesForZeppelinViewRemoval = UpgradeCatalog250.class.getDeclaredMethod("updateTablesForZeppelinViewRemoval");
+    Method updateZeppelinConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateZeppelinConfigs");
     Method updateAtlasConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateAtlasConfigs");
     Method updateLogSearchConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateLogSearchConfigs");
     Method updateAmbariInfraConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateAmbariInfraConfigs");
@@ -297,6 +298,7 @@ public class UpgradeCatalog250Test {
         .addMockedMethod(updateHIVEInteractiveConfigs)
         .addMockedMethod(updateTEZInteractiveConfigs)
         .addMockedMethod(updateTablesForZeppelinViewRemoval)
+        .addMockedMethod(updateZeppelinConfigs)
         .addMockedMethod(updateAtlasConfigs)
         .addMockedMethod(updateLogSearchConfigs)
         .addMockedMethod(updateAmbariInfraConfigs)
@@ -328,6 +330,9 @@ public class UpgradeCatalog250Test {
     upgradeCatalog250.updateTablesForZeppelinViewRemoval();
     expectLastCall().once();
 
+    upgradeCatalog250.updateZeppelinConfigs();
+    expectLastCall().once();
+
     upgradeCatalog250.updateAtlasConfigs();
     expectLastCall().once();