ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject ambari git commit: AMBARI-9711. Start Flume, Knox failed after upgrade from 1.7.0 to 2.0.0 (aonishuk)
Date Fri, 20 Feb 2015 21:49:38 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 6da3dec5c -> 53b75619a


AMBARI-9711. Start Flume, Knox failed after upgrade from 1.7.0 to 2.0.0 (aonishuk)


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

Branch: refs/heads/trunk
Commit: 53b75619a9961c6a55de8fd5a1ca56b8da794deb
Parents: 6da3dec
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Fri Feb 20 23:48:30 2015 +0200
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Fri Feb 20 23:48:30 2015 +0200

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog200.java       | 25 ++++++++++++++++++++
 .../server/upgrade/UpgradeCatalog200Test.java   |  5 ++++
 2 files changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/53b75619/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
index f5dbd38..69e35df 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
@@ -28,6 +28,7 @@ import java.util.Map;
 import java.util.Collections;
 
 import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.orm.DBAccessor;
 import org.apache.ambari.server.orm.DBAccessor.DBColumnInfo;
@@ -51,6 +52,9 @@ import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.SecurityState;
 import org.apache.ambari.server.state.SecurityType;
 import org.apache.ambari.server.state.UpgradeState;
+import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.RepositoryInfo;
+import org.apache.ambari.server.state.OperatingSystemInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -309,6 +313,27 @@ public class UpgradeCatalog200 extends AbstractUpgradeCatalog {
     setSecurityType();
     updateTezConfiguration();
     addMissingConfigs();
+    persistHDPRepo();
+  }
+
+  protected void persistHDPRepo() throws AmbariException{
+    AmbariManagementController amc = injector.getInstance(
+            AmbariManagementController.class);
+    AmbariMetaInfo ambariMetaInfo = amc.getAmbariMetaInfo();
+    Map<String, Cluster> clusterMap = amc.getClusters().getClusters();
+    for (Cluster cluster : clusterMap.values()) {
+      StackId stackId = cluster.getCurrentStackVersion();
+      String stackName = stackId.getStackName();
+      String stackVersion = stackId.getStackVersion();
+      String stackRepoId = stackName + "-" + stackVersion;
+
+      for (OperatingSystemInfo osi : ambariMetaInfo.getOperatingSystems(stackName, stackVersion))
{
+        RepositoryInfo repositoryInfo = ambariMetaInfo.getRepository(stackName, stackVersion,
osi.getOsType(), stackRepoId);
+        String baseUrl = repositoryInfo.getBaseUrl();
+        ambariMetaInfo.updateRepoBaseURL(stackName, stackVersion, osi.getOsType(),
+                stackRepoId, baseUrl);
+      }
+    }
   }
 
   protected void updateTezConfiguration() throws AmbariException {

http://git-wip-us.apache.org/repos/asf/ambari/blob/53b75619/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java
index 1d4713a..5e709fd 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java
@@ -331,6 +331,7 @@ public class UpgradeCatalog200Test {
     Method updateTezConfiguration = UpgradeCatalog200.class.getDeclaredMethod("updateTezConfiguration");
     Method updateConfigurationProperties = AbstractUpgradeCatalog.class.getDeclaredMethod
             ("updateConfigurationProperties", String.class, Map.class, boolean.class, boolean.class);
+    Method persistHDPRepo = UpgradeCatalog200.class.getDeclaredMethod("persistHDPRepo");
 
     UpgradeCatalog200 upgradeCatalog = createMockBuilder(UpgradeCatalog200.class)
         .addMockedMethod(removeNagiosService)
@@ -339,6 +340,7 @@ public class UpgradeCatalog200Test {
         .addMockedMethod(setSecurityType)
         .addMockedMethod(updateTezConfiguration)
         .addMockedMethod(updateConfigurationProperties)
+        .addMockedMethod(persistHDPRepo)
         .createMock();
 
     upgradeCatalog.removeNagiosService();
@@ -358,6 +360,9 @@ public class UpgradeCatalog200Test {
             Collections.singletonMap("hive.server2.transport.mode", "binary"), false, false);
     expectLastCall();
 
+    upgradeCatalog.persistHDPRepo();
+    expectLastCall().once();
+
     replay(upgradeCatalog);
 
     upgradeCatalog.executeDMLUpdates();


Mime
View raw message