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-16100 Upgrade catalog 220 in not idempotent again (dsen)
Date Tue, 26 Apr 2016 15:08:42 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 8add212b3 -> 4c4879e43


AMBARI-16100 Upgrade catalog 220 in not idempotent again (dsen)


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

Branch: refs/heads/trunk
Commit: 4c4879e439a953fd7556fffa81704eae5e0bb048
Parents: 8add212
Author: Dmytro Sen <dsen@apache.org>
Authored: Tue Apr 26 18:08:31 2016 +0300
Committer: Dmytro Sen <dsen@apache.org>
Committed: Tue Apr 26 18:08:31 2016 +0300

----------------------------------------------------------------------
 .../ambari/server/upgrade/UpgradeCatalog220.java       | 10 ++++++----
 .../ambari/server/upgrade/UpgradeCatalog220Test.java   | 13 +++++++++++++
 2 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4c4879e4/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java
index 2580b0e..d806dde 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java
@@ -693,10 +693,12 @@ public class UpgradeCatalog220 extends AbstractUpgradeCatalog {
           if(hdfsService != null) {
             // before 2.2.0 hdfs indentity expected to be in HDFS service
             KerberosIdentityDescriptor hdfsIdentity = hdfsService.getIdentity("hdfs");
-            KerberosComponentDescriptor namenodeComponent = hdfsService.getComponent("NAMENODE");
-            hdfsIdentity.setName("hdfs");
-            hdfsService.removeIdentity("hdfs");
-            namenodeComponent.putIdentity(hdfsIdentity);
+            if (hdfsIdentity != null) {
+              KerberosComponentDescriptor namenodeComponent = hdfsService.getComponent("NAMENODE");
+              hdfsIdentity.setName("hdfs");
+              hdfsService.removeIdentity("hdfs");
+              namenodeComponent.putIdentity(hdfsIdentity);
+            }
           }
           updateKerberosDescriptorIdentityReferences(kerberosDescriptor, "/HDFS/hdfs", "/HDFS/NAMENODE/hdfs");
           updateKerberosDescriptorIdentityReferences(kerberosDescriptor.getServices(), "/HDFS/hdfs",
"/HDFS/NAMENODE/hdfs");

http://git-wip-us.apache.org/repos/asf/ambari/blob/4c4879e4/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java
index 99cabfa..7c1605d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java
@@ -522,6 +522,19 @@ public class UpgradeCatalog220Test {
     assertNotNull(serviceDescriptor);
     assertNull(serviceDescriptor.getIdentity("/HDFS/hdfs"));
     assertNotNull(serviceDescriptor.getIdentity("/HDFS/NAMENODE/hdfs"));
+
+    // check execution with empty kerberos descriptor
+    KerberosDescriptor kerberosDescriptor= new KerberosDescriptorFactory().createInstance(kerberosDescriptorOrig.toMap());
+    ArtifactEntity artifactEntityOrig = createNiceMock(ArtifactEntity.class);
+
+    kerberosDescriptor.getService("HDFS").removeIdentity("hdfs");
+
+    expect(artifactEntityOrig.getArtifactData()).andReturn(kerberosDescriptor.toMap()).once();
+   //expect(artifactDAO.merge((ArtifactEntity) anyObject())).andReturn(null).atLeastOnce();
+    replay(artifactEntityOrig);
+
+    upgradeMock.updateKerberosDescriptorArtifact(createNiceMock(ArtifactDAO.class), artifactEntityOrig);
+    verify(artifactEntityOrig);
   }
 
 


Mime
View raw message