ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-11386 Ambari Upgrade Error 2.0 -> 2.1 (dsen)
Date Tue, 26 May 2015 10:15:26 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk d0580393b -> b7f9b041f


AMBARI-11386 Ambari Upgrade Error 2.0 -> 2.1 (dsen)


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

Branch: refs/heads/trunk
Commit: b7f9b041f75783e237c53dac2170c1596a5a8f7b
Parents: d058039
Author: Dmytro Sen <dsen@apache.org>
Authored: Tue May 26 13:15:04 2015 +0300
Committer: Dmytro Sen <dsen@apache.org>
Committed: Tue May 26 13:15:04 2015 +0300

----------------------------------------------------------------------
 .../controller/AmbariManagementControllerImpl.java       | 11 +++--------
 .../apache/ambari/server/upgrade/UpgradeCatalog210.java  |  3 ++-
 2 files changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b7f9b041/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 266d299..5b902d5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -4043,17 +4043,11 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       widgetEntity.setMetrics(gson.toJson(layoutInfo.getMetricsInfo()));
       widgetEntity.setProperties(gson.toJson(layoutInfo.getProperties()));
       widgetEntity.setWidgetValues(gson.toJson(layoutInfo.getValues()));
+      widgetEntity.setListWidgetLayoutUserWidgetEntity(new LinkedList<WidgetLayoutUserWidgetEntity>());
       LOG.debug("Creating cluster widget with: name = " +
         layoutInfo.getWidgetName() + ", type = " + layoutInfo.getType() + ", " +
         "cluster = " + clusterEntity.getClusterName());
-      widgetDAO.create(widgetEntity);
-
-      createdEntities = widgetDAO.findByName(clusterEntity.getClusterId(), layoutInfo.getWidgetName(),
-              user, layoutInfo.getDefaultSectionName());
-      if (createdEntities != null && !createdEntities.isEmpty()) {
-        return createdEntities.iterator().next();
-      }
-
+      return widgetEntity;
     } else {
       LOG.warn("Skip creating widget from stack artifact since one or more " +
         "already exits with name = " + layoutInfo.getWidgetName() + ", " +
@@ -4101,6 +4095,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
               widgetLayoutUserWidgetEntity.setWidgetOrder(order++);
               widgetLayoutUserWidgetEntity.setWidgetLayout(layoutEntity);
               widgetLayoutUserWidgetEntityList.add(widgetLayoutUserWidgetEntity);
+              widgetEntity.getListWidgetLayoutUserWidgetEntity().add(widgetLayoutUserWidgetEntity);
             }
           }
           layoutEntity.setListWidgetLayoutUserWidgetEntity(widgetLayoutUserWidgetEntityList);

http://git-wip-us.apache.org/repos/asf/ambari/blob/b7f9b041/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 bdfbb1a..ace05ce 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
@@ -629,6 +629,7 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
     for (Long stackEntityId : stackEntityIds) {
       StackEntity stackEntity = stackDAO.findById(stackEntityId);
       String outdatedJson = entityToJsonMap.get(stackEntityId);
+      String outdatedRepoStack = MessageFormat.format("{0}-{1}",stackEntity.getStackName(),stackEntity.getStackVersion());
 
       String clustersSQL = MessageFormat.format(UPDATE_TEMPLATE, "clusters",
           DESIRED_STACK_ID_COLUMN_NAME, stackEntityId,
@@ -663,7 +664,7 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
 
       String repoVersionSQL = MessageFormat.format(UPDATE_TEMPLATE,
           REPO_VERSION_TABLE, STACK_ID_COLUMN_NAME, stackEntityId, "stack",
-          outdatedJson);
+          outdatedRepoStack);
 
       dbAccessor.executeQuery(clustersSQL);
       dbAccessor.executeQuery(hostComponentDesiredStateSQL);


Mime
View raw message