Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 e31c81d9f -> dc0257f8f
  refs/heads/trunk 0dfe8b6c9 -> 8ece8aa6c


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/dc0257f8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/dc0257f8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/dc0257f8

Branch: refs/heads/branch-2.5
Commit: dc0257f8f554dff0d13ef5cdbae29891625cc365
Parents: e31c81d
Author: Renjith Kamath <[email protected]>
Authored: Wed Feb 1 14:39:46 2017 +0530
Committer: Renjith Kamath <[email protected]>
Committed: Wed Feb 1 14:39:46 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/dc0257f8/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 a8a5d17..6b9076c 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();
@@ -295,6 +296,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/dc0257f8/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 bbda783..1c455be 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
@@ -276,6 +276,7 @@ public class UpgradeCatalog250Test {
     Method updateKafkaConfigs = 
UpgradeCatalog250.class.getDeclaredMethod("updateKafkaConfigs");
     Method updateHiveLlapConfigs = 
UpgradeCatalog250.class.getDeclaredMethod("updateHiveLlapConfigs");
     Method updateTablesForZeppelinViewRemoval = 
UpgradeCatalog250.class.getDeclaredMethod("updateTablesForZeppelinViewRemoval");
+    Method updateZeppelinConfigs = 
UpgradeCatalog250.class.getDeclaredMethod("updateZeppelinConfigs");
     Method updateAtlasConfigs = 
UpgradeCatalog250.class.getDeclaredMethod("updateAtlasConfigs");
     Method addNewConfigurationsFromXml = 
AbstractUpgradeCatalog.class.getDeclaredMethod("addNewConfigurationsFromXml");
     Method updateHIVEInteractiveConfigs = 
UpgradeCatalog250.class.getDeclaredMethod("updateHIVEInteractiveConfigs");
@@ -294,6 +295,7 @@ public class UpgradeCatalog250Test {
       .addMockedMethod(updateTEZInteractiveConfigs)
       .addMockedMethod(updateHiveLlapConfigs)
       .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();
 

Reply via email to