You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ad...@apache.org on 2017/11/30 08:05:02 UTC

[1/2] ambari git commit: AMBARI-22550. Service install/start failure due to wrong version directory

Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 128c7fb5f -> 6db752cb0
  refs/heads/trunk ff08592a3 -> 19e6518d4


AMBARI-22550. Service install/start failure due to wrong version directory


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

Branch: refs/heads/branch-2.6
Commit: 6db752cb0c2f6b024d85a597f1385a9c2189ad2a
Parents: 128c7fb
Author: Doroszlai, Attila <ad...@hortonworks.com>
Authored: Wed Nov 29 19:02:32 2017 +0100
Committer: Doroszlai, Attila <ad...@hortonworks.com>
Committed: Thu Nov 30 09:01:05 2017 +0100

----------------------------------------------------------------------
 .../actionmanager/ExecutionCommandWrapper.java       |  5 +++++
 .../actionmanager/ExecutionCommandWrapperTest.java   | 15 +++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6db752cb/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
index 212363b..f9935bd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
@@ -302,7 +302,12 @@ public class ExecutionCommandWrapper {
       if (null != repositoryVersion) {
         // only set the version if it's not set and this is NOT an install
         // command
+        // Some stack scripts use version for path purposes.  Sending unresolved version first (for
+        // blueprints) and then resolved one would result in various issues: duplicate directories
+        // (/hdp/apps/2.6.3.0 + /hdp/apps/2.6.3.0-235), parent directory not found, and file not
+        // found, etc.  Hence requiring repositoryVersion to be resolved.
         if (!commandParams.containsKey(VERSION)
+          && repositoryVersion.isResolved()
           && executionCommand.getRoleCommand() != RoleCommand.INSTALL) {
           commandParams.put(VERSION, repositoryVersion.getVersion());
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6db752cb/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
index 7630c55..2efc7a7 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
@@ -318,8 +318,7 @@ public class ExecutionCommandWrapperTest {
     commandParams = processedExecutionCommand.getCommandParams();
     Assert.assertFalse(commandParams.containsKey(KeyNames.VERSION));
 
-    // now try with a START command which should populate the version even
-    // though the state is INSTALLING
+    // now try with a START command, but still unresolved
     executionCommand = new ExecutionCommand();
     commandParams = new HashMap<>();
 
@@ -340,6 +339,17 @@ public class ExecutionCommandWrapperTest {
 
     processedExecutionCommand = execCommWrap.getExecutionCommand();
     commandParams = processedExecutionCommand.getCommandParams();
+    Assert.assertFalse(commandParams.containsKey(KeyNames.VERSION));
+
+    // now that the repositoryVersion is resolved, it should populate the version even
+    // though the state is INSTALLING
+    repositoryVersion.setResolved(true);
+    ormTestHelper.repositoryVersionDAO.merge(repositoryVersion);
+    execCommWrap = new ExecutionCommandWrapper(json);
+    injector.injectMembers(execCommWrap);
+
+    processedExecutionCommand = execCommWrap.getExecutionCommand();
+    commandParams = processedExecutionCommand.getCommandParams();
     Assert.assertEquals("0.1-0000", commandParams.get(KeyNames.VERSION));
   }
 
@@ -352,6 +362,7 @@ public class ExecutionCommandWrapperTest {
 
     StackId stackId = cluster.getDesiredStackVersion();
     RepositoryVersionEntity repositoryVersion = ormTestHelper.getOrCreateRepositoryVersion(stackId, "0.1-0000");
+    repositoryVersion.setResolved(true); // has build number
     Service service = cluster.getService("HDFS");
     service.setDesiredRepositoryVersion(repositoryVersion);
 


[2/2] ambari git commit: AMBARI-22550. Service install/start failure due to wrong version directory

Posted by ad...@apache.org.
AMBARI-22550. Service install/start failure due to wrong version directory


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

Branch: refs/heads/trunk
Commit: 19e6518d42170a33ca2e0161ec2d3abb5190f976
Parents: ff08592
Author: Doroszlai, Attila <ad...@hortonworks.com>
Authored: Wed Nov 29 19:02:32 2017 +0100
Committer: Doroszlai, Attila <ad...@hortonworks.com>
Committed: Thu Nov 30 09:02:46 2017 +0100

----------------------------------------------------------------------
 .../actionmanager/ExecutionCommandWrapper.java       |  5 +++++
 .../actionmanager/ExecutionCommandWrapperTest.java   | 15 +++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/19e6518d/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
index 7b693cd..191e86c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
@@ -297,7 +297,12 @@ public class ExecutionCommandWrapper {
       if (null != repositoryVersion) {
         // only set the version if it's not set and this is NOT an install
         // command
+        // Some stack scripts use version for path purposes.  Sending unresolved version first (for
+        // blueprints) and then resolved one would result in various issues: duplicate directories
+        // (/hdp/apps/2.6.3.0 + /hdp/apps/2.6.3.0-235), parent directory not found, and file not
+        // found, etc.  Hence requiring repositoryVersion to be resolved.
         if (!commandParams.containsKey(VERSION)
+          && repositoryVersion.isResolved()
           && executionCommand.getRoleCommand() != RoleCommand.INSTALL) {
           commandParams.put(VERSION, repositoryVersion.getVersion());
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/19e6518d/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
index fb84df5..f12c701 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
@@ -312,8 +312,7 @@ public class ExecutionCommandWrapperTest {
     commandParams = processedExecutionCommand.getCommandParams();
     Assert.assertFalse(commandParams.containsKey(KeyNames.VERSION));
 
-    // now try with a START command which should populate the version even
-    // though the state is INSTALLING
+    // now try with a START command, but still unresolved
     executionCommand = new ExecutionCommand();
     commandParams = new HashMap<>();
 
@@ -334,6 +333,17 @@ public class ExecutionCommandWrapperTest {
 
     processedExecutionCommand = execCommWrap.getExecutionCommand();
     commandParams = processedExecutionCommand.getCommandParams();
+    Assert.assertFalse(commandParams.containsKey(KeyNames.VERSION));
+
+    // now that the repositoryVersion is resolved, it should populate the version even
+    // though the state is INSTALLING
+    repositoryVersion.setResolved(true);
+    ormTestHelper.repositoryVersionDAO.merge(repositoryVersion);
+    execCommWrap = new ExecutionCommandWrapper(json);
+    injector.injectMembers(execCommWrap);
+
+    processedExecutionCommand = execCommWrap.getExecutionCommand();
+    commandParams = processedExecutionCommand.getCommandParams();
     Assert.assertEquals("0.1-0000", commandParams.get(KeyNames.VERSION));
     }
 
@@ -346,6 +356,7 @@ public class ExecutionCommandWrapperTest {
 
     StackId stackId = cluster.getDesiredStackVersion();
     RepositoryVersionEntity repositoryVersion = ormTestHelper.getOrCreateRepositoryVersion(stackId, "0.1-0000");
+    repositoryVersion.setResolved(true); // has build number
     Service service = cluster.getService("HDFS");
     service.setDesiredRepositoryVersion(repositoryVersion);