Browse Source

AMBARI-7489. Fix upgrade when Ooozie is not installed.(vbrodetskyi)

Vitaly Brodetskyi 10 years ago
parent
commit
c9a7a3c4aa

+ 7 - 4
ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java

@@ -988,10 +988,10 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog {
 
   protected void addMissingConfigs() throws AmbariException {
     addNewConfigurationsFromXml();
-    addOozieConfig();
+    updateOozieConfigLog4j();
   }
 
-  protected void addOozieConfig() throws AmbariException {
+  protected void updateOozieConfigLog4j() throws AmbariException {
     final String PROPERTY_NAME = "log4j.appender.oozie.layout.ConversionPattern=";
     final String PROPERTY_VALUE_OLD = "%d{ISO8601} %5p %c{1}:%L - %m%n";
     final String PROPERTY_VALUE_NEW = "%d{ISO8601} %5p %c{1}:%L - SERVER[${oozie.instance.id}] %m%n";
@@ -1007,8 +1007,11 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog {
 
       if (clusterMap != null && !clusterMap.isEmpty()) {
         for (final Cluster cluster : clusterMap.values()) {
-          content = cluster.getDesiredConfigByType(
-              "oozie-log4j").getProperties().get("content");
+          content = null;
+          if (cluster.getDesiredConfigByType("oozie-log4j") != null) {
+            content = cluster.getDesiredConfigByType(
+                "oozie-log4j").getProperties().get("content");
+          }
 
           if (content != null) {
             content = content.replace(PROPERTY_NAME + PROPERTY_VALUE_OLD,