incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject svn commit: r1466215 - in /incubator/ambari/trunk: ./ ambari-server/src/main/java/org/apache/ambari/eventdb/webservice/ ambari-server/src/main/java/org/apache/ambari/server/configuration/ ambari-server/src/main/java/org/apache/ambari/server/utils/ amba...
Date Tue, 09 Apr 2013 20:25:34 GMT
Author: smohanty
Date: Tue Apr  9 20:25:34 2013
New Revision: 1466215

URL: http://svn.apache.org/r1466215
Log:
AMBARI-1860. Master broken - Cannot deploy services. (smohanty)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/eventdb/webservice/WorkflowJsonService.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1466215&r1=1466214&r2=1466215&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Tue Apr  9 20:25:34 2013
@@ -665,6 +665,8 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1860. Master broken - Cannot deploy services. (smohanty)
+
  AMBARI-1859. Cannot load Nagios Alerts due to 400 Bad Request. (smohanty)
 
  AMBARI-1842. Collapsable service restart message section should have pointer 

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/eventdb/webservice/WorkflowJsonService.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/eventdb/webservice/WorkflowJsonService.java?rev=1466215&r1=1466214&r2=1466215&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/eventdb/webservice/WorkflowJsonService.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/eventdb/webservice/WorkflowJsonService.java
Tue Apr  9 20:25:34 2013
@@ -81,6 +81,9 @@ public class WorkflowJsonService {
   public static void setDBProperties(Configuration configuration) {
     DEFAULT_DRIVER = configuration.getRcaDatabaseDriver();
     DEFAULT_URL = configuration.getRcaDatabaseUrl();
+    if (DEFAULT_URL.contains(Configuration.HOSTNAME_MACRO)) {
+      DEFAULT_URL = DEFAULT_URL.replace(Configuration.HOSTNAME_MACRO, "localhost");
+    }
     DEFAULT_USERNAME = configuration.getRcaDatabaseUser();
     DEFAULT_PASSWORD = configuration.getRcaDatabasePassword();
   }

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java?rev=1466215&r1=1466214&r2=1466215&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
Tue Apr  9 20:25:34 2013
@@ -130,7 +130,8 @@ public class Configuration {
   public static final String JDBC_IN_MEMORY_URL = "jdbc:derby:memory:myDB/ambari;create=true";
   public static final String JDBC_IN_MEMROY_DRIVER = "org.apache.derby.jdbc.EmbeddedDriver";
 
-  public static final String JDBC_RCA_LOCAL_URL = "jdbc:postgresql://localhost/ambarirca";
+  public static final String HOSTNAME_MACRO = "{hostname}";
+  public static final String JDBC_RCA_LOCAL_URL = "jdbc:postgresql://" + HOSTNAME_MACRO +
"/ambarirca";
   public static final String JDBC_RCA_LOCAL_DRIVER = "org.postgresql.Driver";
 
   private static final String SERVER_JDBC_USER_NAME_DEFAULT = "ambari-server";

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java?rev=1466215&r1=1466214&r2=1466215&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
Tue Apr  9 20:25:34 2013
@@ -207,7 +207,11 @@ public class StageUtils {
             //Set up ambari-rca connection properties, is this a hack?
 //            info.put("ambari_db_server_host", Arrays.asList(hostsMap.getHostMap(getHostName())));
             Configuration configuration = injector.getInstance(Configuration.class);
-            info.put("ambari_db_rca_url", Arrays.asList(configuration.getRcaDatabaseUrl()));
+            String url = configuration.getRcaDatabaseUrl();
+            if (url.contains(Configuration.HOSTNAME_MACRO)) {
+              url = url.replace(Configuration.HOSTNAME_MACRO, hostsMap.getHostMap(getHostName()));
+            }
+            info.put("ambari_db_rca_url", Arrays.asList(url));
             info.put("ambari_db_rca_driver", Arrays.asList(configuration.getRcaDatabaseDriver()));
             info.put("ambari_db_rca_username", Arrays.asList(configuration.getRcaDatabaseUser()));
             info.put("ambari_db_rca_password", Arrays.asList(configuration.getRcaDatabasePassword()));

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java?rev=1466215&r1=1466214&r2=1466215&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java
Tue Apr  9 20:25:34 2013
@@ -18,8 +18,12 @@
 package org.apache.ambari.server.utils;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -157,7 +161,7 @@ public class TestStageUtils {
   }
 
   @Test
-  public void testGetClusterHostInfo() throws AmbariException {
+  public void testGetClusterHostInfo() throws AmbariException, UnknownHostException {
     Clusters fsm = injector.getInstance(Clusters.class);
     fsm.addCluster("c1");
     fsm.addHost("h1");
@@ -181,5 +185,10 @@ public class TestStageUtils {
     assertEquals(2, info.get("slave_hosts").size());
     assertEquals(1, info.get("hbase_master_hosts").size());
     assertEquals("h1", info.get("hbase_master_hosts").get(0));
+
+    assertFalse(info.get("ambari_db_rca_url").get(0).contains(Configuration.HOSTNAME_MACRO));
+    String address = InetAddress.getLocalHost().getCanonicalHostName();
+    assertTrue(info.get("ambari_db_rca_url").get(0).contains(address));
+
   }
 }



Mime
View raw message