ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject [1/2] ambari git commit: AMBARI-20811. Trying to upgrade HDF 2.0.2.0 to HDF 3.0.0.0 fails with NPE (dlysnichenko)
Date Fri, 21 Apr 2017 13:10:15 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 3db6bbc5a -> 45c7f5f6b
  refs/heads/trunk a94abb109 -> 04f31104b


AMBARI-20811. Trying to upgrade HDF 2.0.2.0 to HDF 3.0.0.0 fails with NPE (dlysnichenko)


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

Branch: refs/heads/branch-2.5
Commit: 45c7f5f6b4bc4c6569702e04a70f5d97fb98cd1a
Parents: 3db6bbc
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Fri Apr 21 16:09:01 2017 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Fri Apr 21 16:09:01 2017 +0300

----------------------------------------------------------------------
 .../java/org/apache/ambari/server/stack/StackDirectory.java    | 4 ++++
 .../java/org/apache/ambari/server/stack/StackManagerTest.java  | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/45c7f5f6/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
index daa9014..40139c6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
@@ -20,6 +20,7 @@ package org.apache.ambari.server.stack;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
@@ -438,6 +439,9 @@ public class StackDirectory extends StackDefinitionDirectory {
     if (configUpgradePack != null) {
       this.configUpgradePack = configUpgradePack;
     } else {
+      ConfigUpgradePack emptyConfigUpgradePack = new ConfigUpgradePack();
+      emptyConfigUpgradePack.services = new ArrayList<>();
+      this.configUpgradePack = emptyConfigUpgradePack;
       LOG.info("Stack '{}' doesn't contain config upgrade pack file", getPath());
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/45c7f5f6/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
index 0234d79..86ff263 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
@@ -58,6 +58,7 @@ import org.apache.ambari.server.state.PropertyInfo;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.ServiceOsSpecific;
 import org.apache.ambari.server.state.StackInfo;
+import org.apache.ambari.server.state.stack.ConfigUpgradePack;
 import org.apache.ambari.server.state.stack.MetricDefinition;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.apache.ambari.server.state.stack.UpgradePack;
@@ -712,7 +713,7 @@ public class StackManagerTest {
   }
 
   /**
-   * Tests that {@link UpgradePack} instances are correctly initialized
+   * Tests that {@link UpgradePack} and {@link ConfigUpgradePack} instances are correctly
initialized
    * post-unmarshalling.
    *
    * @throws Exception
@@ -729,6 +730,9 @@ public class StackManagerTest {
       // reference equality (make sure it's the same list)
       assertTrue(upgradePack.getTasks() == upgradePack.getTasks());
     }
+    ConfigUpgradePack configUpgradePack = stack.getConfigUpgradePack();
+    assertNotNull(configUpgradePack);
+    assertNotNull(configUpgradePack.services);
   }
 
   @Test


Mime
View raw message