ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject ambari git commit: AMBARI-11621. Upgrade failed from 2.0 to 2.1 with build # 1890.(vbrodetskyi)
Date Tue, 02 Jun 2015 14:49:02 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e30a1c829 -> 9fa9c756e


AMBARI-11621. Upgrade failed from 2.0 to 2.1 with build # 1890.(vbrodetskyi)


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

Branch: refs/heads/trunk
Commit: 9fa9c756e8994ad374a897dbd6c6167aef94a492
Parents: e30a1c8
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Tue Jun 2 13:01:18 2015 +0300
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Tue Jun 2 13:01:18 2015 +0300

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog210.java       | 42 +++++++++++---------
 1 file changed, 24 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9fa9c756/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
index abbee4e..a79d7f3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
@@ -913,40 +913,46 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
           for (String metricName : metricAlerts) {
             AlertDefinitionEntity alertDefinitionEntity =  alertDefinitionDAO.findByName(cluster.getClusterId(),
                     metricName);
-            String source = alertDefinitionEntity.getSource();
-            JsonObject rootJson = new JsonParser().parse(source).getAsJsonObject();
-            rootJson.get("uri").getAsJsonObject().addProperty("kerberos_keytab",
+            if (alertDefinitionEntity != null) {
+              String source = alertDefinitionEntity.getSource();
+              JsonObject rootJson = new JsonParser().parse(source).getAsJsonObject();
+              rootJson.get("uri").getAsJsonObject().addProperty("kerberos_keytab",
                     "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}");
-            rootJson.get("uri").getAsJsonObject().addProperty("kerberos_principal",
+              rootJson.get("uri").getAsJsonObject().addProperty("kerberos_principal",
                     "{{hdfs-site/dfs.web.authentication.kerberos.principal}}");
-            alertDefinitionEntity.setSource(rootJson.toString());
-            alertDefinitionDAO.merge(alertDefinitionEntity);
+              alertDefinitionEntity.setSource(rootJson.toString());
+              alertDefinitionDAO.merge(alertDefinitionEntity);
+            }
           }
 
           for (String metricName : mapredAlerts) {
             AlertDefinitionEntity alertDefinitionEntity =  alertDefinitionDAO.findByName(cluster.getClusterId(),
                     metricName);
-            String source = alertDefinitionEntity.getSource();
-            JsonObject rootJson = new JsonParser().parse(source).getAsJsonObject();
-            rootJson.get("uri").getAsJsonObject().addProperty("kerberos_keytab",
+            if (alertDefinitionEntity != null) {
+              String source = alertDefinitionEntity.getSource();
+              JsonObject rootJson = new JsonParser().parse(source).getAsJsonObject();
+              rootJson.get("uri").getAsJsonObject().addProperty("kerberos_keytab",
                     "{{mapred-site/mapreduce.jobhistory.webapp.spnego-keytab-file}}");
-            rootJson.get("uri").getAsJsonObject().addProperty("kerberos_principal",
+              rootJson.get("uri").getAsJsonObject().addProperty("kerberos_principal",
                     "{{mapred-site/mapreduce.jobhistory.webapp.spnego-principal}}");
-            alertDefinitionEntity.setSource(rootJson.toString());
-            alertDefinitionDAO.merge(alertDefinitionEntity);
+              alertDefinitionEntity.setSource(rootJson.toString());
+              alertDefinitionDAO.merge(alertDefinitionEntity);
+            }
           }
 
           for (String metricName : rmAlerts) {
             AlertDefinitionEntity alertDefinitionEntity =  alertDefinitionDAO.findByName(cluster.getClusterId(),
                     metricName);
-            String source = alertDefinitionEntity.getSource();
-            JsonObject rootJson = new JsonParser().parse(source).getAsJsonObject();
-            rootJson.get("uri").getAsJsonObject().addProperty("kerberos_keytab",
+            if (alertDefinitionEntity != null) {
+              String source = alertDefinitionEntity.getSource();
+              JsonObject rootJson = new JsonParser().parse(source).getAsJsonObject();
+              rootJson.get("uri").getAsJsonObject().addProperty("kerberos_keytab",
                     "{{yarn-site/yarn.resourcemanager.webapp.spnego-keytab-file}}");
-            rootJson.get("uri").getAsJsonObject().addProperty("kerberos_principal",
+              rootJson.get("uri").getAsJsonObject().addProperty("kerberos_principal",
                     "{{yarn-site/yarn.resourcemanager.webapp.spnego-principal}}");
-            alertDefinitionEntity.setSource(rootJson.toString());
-            alertDefinitionDAO.merge(alertDefinitionEntity);
+              alertDefinitionEntity.setSource(rootJson.toString());
+              alertDefinitionDAO.merge(alertDefinitionEntity);
+            }
           }
         }
       }


Mime
View raw message