ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hapyles...@apache.org
Subject [1/2] ambari git commit: AMBARI-22690 Registering existing hdp version failed with sql exception (dgrinenko)
Date Tue, 02 Jan 2018 15:25:44 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 29ffc7ef9 -> 4d3d57b64
  refs/heads/trunk aa5b0fe76 -> a95759d2f


AMBARI-22690 Registering existing hdp version failed with sql exception (dgrinenko)


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

Branch: refs/heads/branch-2.6
Commit: 4d3d57b64a6f703d05d92afbc27b69e3c1affad8
Parents: 29ffc7e
Author: Dmytro Grinenko <hapylestat@apache.org>
Authored: Tue Jan 2 17:23:57 2018 +0200
Committer: Dmytro Grinenko <hapylestat@apache.org>
Committed: Tue Jan 2 17:23:57 2018 +0200

----------------------------------------------------------------------
 .../ambari/server/orm/entities/RepositoryVersionEntity.java     | 5 +++++
 .../internal/VersionDefinitionResourceProviderTest.java         | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3d57b6/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
index cee7028..6d3ac44 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
@@ -237,6 +237,11 @@ public class RepositoryVersionEntity {
    */
   public void setVersion(String version) {
     this.version = version;
+
+    // need to be called to avoid work with wrong value until entity would be persisted
+    if (null != version && null != stack && null != stack.getStackName()){
+      removePrefixFromVersion();
+    }
   }
 
   public String getDisplayName() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d3d57b6/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
index 2c94747..aedde64 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
@@ -536,7 +536,7 @@ public class VersionDefinitionResourceProviderTest {
 
     res = status.getAssociatedResources().iterator().next();
     Assert.assertTrue(res.getPropertiesMap().containsKey("VersionDefinition"));
-    Assert.assertEquals("HDP-2.2.0.4-a", res.getPropertyValue("VersionDefinition/repository_version"));
+    Assert.assertEquals("2.2.0.4-a", res.getPropertyValue("VersionDefinition/repository_version"));
     Assert.assertEquals("HDP-2.2.0.4-a", res.getPropertyValue("VersionDefinition/display_name"));
     Assert.assertNotNull(res.getPropertyValue("VersionDefinition/show_available"));
     Assert.assertNotNull(res.getPropertyValue("VersionDefinition/validation"));


Mime
View raw message