ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject git commit: AMBARI-7472. Ooozie config change in Ambari (aonishuk)
Date Wed, 24 Sep 2014 18:10:26 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 738d8b1ac -> 6d2fb690a


AMBARI-7472. Ooozie config change in Ambari (aonishuk)


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

Branch: refs/heads/trunk
Commit: 6d2fb690ace55e46b9683798afd80dbdb48a70db
Parents: 738d8b1
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Wed Sep 24 21:07:13 2014 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Wed Sep 24 21:07:13 2014 +0300

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog170.java       | 33 ++++++++++++++++++++
 .../OOZIE/configuration/oozie-log4j.xml         |  2 +-
 .../OOZIE/configuration/oozie-log4j.xml         |  2 +-
 .../package/templates/oozie-log4j.properties.j2 |  2 +-
 .../server/upgrade/UpgradeCatalog170Test.java   |  2 ++
 5 files changed, 38 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6d2fb690/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
index bbc29f2..7e7738c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
@@ -992,6 +992,39 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog {
 
   protected void addMissingConfigs() throws AmbariException {
     addNewConfigurationsFromXml();
+    addOozieConfig();
+  }
+
+  protected void addOozieConfig() 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";
+
+    AmbariManagementController ambariManagementController = injector.getInstance(
+        AmbariManagementController.class);
+    Clusters clusters = ambariManagementController.getClusters();
+
+    if (clusters != null) {
+      Map<String, Cluster> clusterMap = clusters.getClusters();
+      Map<String, String> prop = new HashMap<String, String>();
+      String content = null;
+
+      if (clusterMap != null && !clusterMap.isEmpty()) {
+        for (final Cluster cluster : clusterMap.values()) {
+          content = cluster.getDesiredConfigByType(
+              "oozie-log4j").getProperties().get("content");
+
+          if (content != null) {
+            content = content.replace(PROPERTY_NAME + PROPERTY_VALUE_OLD,
+                PROPERTY_NAME + PROPERTY_VALUE_NEW);
+
+            prop.put("content", content);
+            updateConfigurationPropertiesForCluster(cluster, "oozie-log4j",
+                prop, true, false);
+          }
+        }
+      }
+    }
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/6d2fb690/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/OOZIE/configuration/oozie-log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/OOZIE/configuration/oozie-log4j.xml
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/OOZIE/configuration/oozie-log4j.xml
index d885c66..7f7158f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/OOZIE/configuration/oozie-log4j.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/OOZIE/configuration/oozie-log4j.xml
@@ -52,7 +52,7 @@ log4j.appender.oozie.DatePattern='.'yyyy-MM-dd-HH
 log4j.appender.oozie.File=${oozie.log.dir}/oozie.log
 log4j.appender.oozie.Append=true
 log4j.appender.oozie.layout=org.apache.log4j.PatternLayout
-log4j.appender.oozie.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - %m%n
+log4j.appender.oozie.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - SERVER[${oozie.instance.id}]
%m%n
 
 log4j.appender.oozieops=org.apache.log4j.DailyRollingFileAppender
 log4j.appender.oozieops.DatePattern='.'yyyy-MM-dd

http://git-wip-us.apache.org/repos/asf/ambari/blob/6d2fb690/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/configuration/oozie-log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/configuration/oozie-log4j.xml
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/configuration/oozie-log4j.xml
index d885c66..7f7158f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/configuration/oozie-log4j.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/configuration/oozie-log4j.xml
@@ -52,7 +52,7 @@ log4j.appender.oozie.DatePattern='.'yyyy-MM-dd-HH
 log4j.appender.oozie.File=${oozie.log.dir}/oozie.log
 log4j.appender.oozie.Append=true
 log4j.appender.oozie.layout=org.apache.log4j.PatternLayout
-log4j.appender.oozie.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - %m%n
+log4j.appender.oozie.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - SERVER[${oozie.instance.id}]
%m%n
 
 log4j.appender.oozieops=org.apache.log4j.DailyRollingFileAppender
 log4j.appender.oozieops.DatePattern='.'yyyy-MM-dd

http://git-wip-us.apache.org/repos/asf/ambari/blob/6d2fb690/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/package/templates/oozie-log4j.properties.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/package/templates/oozie-log4j.properties.j2
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/package/templates/oozie-log4j.properties.j2
index b571a76..8c9f25e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/package/templates/oozie-log4j.properties.j2
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/package/templates/oozie-log4j.properties.j2
@@ -51,7 +51,7 @@ log4j.appender.oozie.DatePattern='.'yyyy-MM-dd-HH
 log4j.appender.oozie.File=${oozie.log.dir}/oozie.log
 log4j.appender.oozie.Append=true
 log4j.appender.oozie.layout=org.apache.log4j.PatternLayout
-log4j.appender.oozie.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - %m%n
+log4j.appender.oozie.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - SERVER[${oozie.instance.id}]
%m%n
 
 log4j.appender.oozieops=org.apache.log4j.DailyRollingFileAppender
 log4j.appender.oozieops.DatePattern='.'yyyy-MM-dd

http://git-wip-us.apache.org/repos/asf/ambari/blob/6d2fb690/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
index 6bc7a3b..2edc5b5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
@@ -518,7 +518,9 @@ public class UpgradeCatalog170Test {
     expect(amc.getClusters()).andReturn(clusters).anyTimes();
     expect(clusters.getClusters()).andReturn(clustersMap).anyTimes();
     expect(clusters.getClusterById(1L)).andReturn(clustersMap.values().iterator().next()).anyTimes();
+    expect(clusters.getClusters()).andReturn(clustersMap).once();
     expect(cluster.getDesiredConfigByType("global")).andReturn(config).anyTimes();
+    expect(cluster.getDesiredConfigByType("oozie-log4j")).andReturn(config).anyTimes();
     expect(cluster.getClusterId()).andReturn(1L);
     expect(cluster.getNextConfigVersion("hadoop-env")).andReturn(3L);
     expect(config.getProperties()).andReturn(globalConfigs).anyTimes();


Mime
View raw message