You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2015/01/26 15:44:23 UTC

ambari git commit: AMBARI-9249. Downloads configuration files have not same values that files at nodes. (aonishuk)

Repository: ambari
Updated Branches:
  refs/heads/trunk 7552355ce -> d8dc285a5


AMBARI-9249. Downloads configuration files have not same values that files at nodes. (aonishuk)


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

Branch: refs/heads/trunk
Commit: d8dc285a5c5499e70ff14154889c1ec6d1f30ddc
Parents: 7552355
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Jan 26 16:44:15 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Jan 26 16:44:15 2015 +0200

----------------------------------------------------------------------
 .../server/actionmanager/ActionScheduler.java   |  8 ++-
 .../AmbariManagementControllerImpl.java         |  6 --
 .../actionmanager/TestActionScheduler.java      | 26 +++++---
 .../AmbariManagementControllerTest.java         | 70 --------------------
 4 files changed, 25 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d8dc285a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
index 6511369..d5fa5b5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
@@ -298,7 +298,13 @@ class ActionScheduler implements Runnable {
         //Schedule what we have so far
 
         for (ExecutionCommand cmd : commandsToSchedule) {
-            processHostRole(stage, cmd, commandsToStart, commandsToUpdate);
+
+          // Hack - Remove passwords from configs
+          if (cmd.getRole().equals(Role.HIVE_CLIENT.toString()) &&
+                  cmd.getConfigurations().containsKey(Configuration.HIVE_CONFIG_TAG)) {
+            cmd.getConfigurations().get(Configuration.HIVE_CONFIG_TAG).remove(Configuration.HIVE_METASTORE_PASSWORD_PROPERTY);
+          }
+          processHostRole(stage, cmd, commandsToStart, commandsToUpdate);
         }
 
         LOG.debug("==> Commands to start: {}", commandsToStart.size());

http://git-wip-us.apache.org/repos/asf/ambari/blob/d8dc285a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 106c1dd..e7d03e3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -1633,12 +1633,6 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
 
     Host host = clusters.getHost(scHost.getHostName());
 
-    // Hack - Remove passwords from configs
-    if (event.getServiceComponentName().equals(Role.HIVE_CLIENT.toString())) {
-      configHelper.applyCustomConfig(configurations, Configuration.HIVE_CONFIG_TAG,
-        Configuration.HIVE_METASTORE_PASSWORD_PROPERTY, "", true);
-    }
-
     String jobtrackerHost = getJobTrackerHost(cluster);
     if (!scHost.getHostName().equals(jobtrackerHost)) {
       if (configTags.get(Configuration.GLOBAL_CONFIG_TAG) != null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/d8dc285a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
index 139dff6..8352a28 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
@@ -891,10 +891,18 @@ public class TestActionScheduler {
     when(scomp.getServiceComponentHosts()).thenReturn(hosts);
 
     List<Stage> stages = new ArrayList<Stage>();
-    stages.add(
-            getStageWithSingleTask(
-                    hostname1, "cluster1", Role.DATANODE,
-                    RoleCommand.START, Service.Type.HDFS, 1, 1, 1));
+    Stage stage = getStageWithSingleTask(
+            hostname1, "cluster1", Role.HIVE_CLIENT,
+            RoleCommand.INSTALL, Service.Type.HIVE, 1, 1, 1);
+    Map<String, String> hiveSite = new TreeMap<String, String>();
+    hiveSite.put("javax.jdo.option.ConnectionPassword", "password");
+    hiveSite.put("hive.server2.thrift.port", "10000");
+    Map<String, Map<String, String>> configurations =
+            new TreeMap<String, Map<String, String>>();
+    configurations.put("hive-site", hiveSite);
+    stage.getExecutionCommands(hostname1).get(0).getExecutionCommand().setConfigurations(configurations);
+    stages.add(stage);
+
     stages.add( // Stage with the same hostname, should not be scheduled
         getStageWithSingleTask(
             hostname1, "cluster1", Role.GANGLIA_MONITOR,
@@ -902,8 +910,8 @@ public class TestActionScheduler {
 
     stages.add(
         getStageWithSingleTask(
-            hostname2, "cluster1", Role.DATANODE,
-            RoleCommand.START, Service.Type.HDFS, 3, 3, 3));
+            hostname2, "cluster1", Role.HIVE_CLIENT,
+            RoleCommand.INSTALL, Service.Type.HIVE, 3, 3, 3));
 
     stages.add(
         getStageWithSingleTask(
@@ -937,11 +945,13 @@ public class TestActionScheduler {
 
     scheduler.doWork();
 
-    Assert.assertEquals(HostRoleStatus.QUEUED, stages.get(0).getHostRoleStatus(hostname1, "DATANODE"));
+    Assert.assertEquals(HostRoleStatus.QUEUED, stages.get(0).getHostRoleStatus(hostname1, "HIVE_CLIENT"));
     Assert.assertEquals(HostRoleStatus.PENDING, stages.get(1).getHostRoleStatus(hostname1, "GANGLIA_MONITOR"));
-    Assert.assertEquals(HostRoleStatus.PENDING, stages.get(2).getHostRoleStatus(hostname2, "DATANODE"));
+    Assert.assertEquals(HostRoleStatus.PENDING, stages.get(2).getHostRoleStatus(hostname2, "HIVE_CLIENT"));
     Assert.assertEquals(HostRoleStatus.PENDING, stages.get(3).getHostRoleStatus(hostname3, "DATANODE"));
     Assert.assertEquals(HostRoleStatus.PENDING, stages.get(4).getHostRoleStatus(hostname4, "GANGLIA_MONITOR"));
+    Assert.assertFalse(stages.get(0).getExecutionCommands(hostname1).get(0).getExecutionCommand().
+            getConfigurations().containsKey("javax.jdo.option.ConnectionPassword"));
   }
   /**
    * Verifies that ActionScheduler allows to execute background tasks in parallel

http://git-wip-us.apache.org/repos/asf/ambari/blob/d8dc285a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index f6c34f2..1d26d82 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -5898,76 +5898,6 @@ public class AmbariManagementControllerTest {
   }
 
   @Test
-  public void testHivePasswordAbsentInConfigs() throws AmbariException {
-    String clusterName = "c1";
-    String serviceName = "HIVE";
-    createCluster(clusterName);
-    Cluster cluster = clusters.getCluster(clusterName);
-    cluster.setDesiredStackVersion(new StackId("HDP-1.2.0"));
-    createService(clusterName, serviceName, null);
-
-    String componentName1 = "HIVE_METASTORE";
-    String componentName2 = "HIVE_SERVER";
-    String componentName3 = "HIVE_CLIENT";
-
-    createServiceComponent(clusterName, serviceName, componentName1,
-      State.INIT);
-    createServiceComponent(clusterName, serviceName, componentName2,
-      State.INIT);
-    createServiceComponent(clusterName, serviceName, componentName3,
-      State.INIT);
-
-    String host1 = "h1";
-    String host2 = "h2";
-    addHost(host1, clusterName);
-    addHost(host2, clusterName);
-
-    createServiceComponentHost(clusterName, serviceName, componentName1,
-      host1, null);
-    createServiceComponentHost(clusterName, serviceName, componentName2,
-      host1, null);
-    createServiceComponentHost(clusterName, serviceName, componentName3,
-      host1, null);
-    createServiceComponentHost(clusterName, serviceName, componentName3,
-      host2, null);
-
-    Map<String, String> configs = new HashMap<String, String>();
-    configs.put("a", "b");
-    configs.put(Configuration.HIVE_METASTORE_PASSWORD_PROPERTY, "aaa");
-
-    ConfigurationRequest cr1;
-    cr1 = new ConfigurationRequest(clusterName, "hive-site","version1",
-      configs, null);
-    ClusterRequest crReq = new ClusterRequest(cluster.getClusterId(), clusterName, null, null);
-    crReq.setDesiredConfig(Collections.singletonList(cr1));
-    controller.updateClusters(Collections.singleton(crReq), null);
-
-    // Install
-    installService(clusterName, serviceName, false, false);
-    // Start
-    long requestId = startService(clusterName, serviceName, false, true);
-
-    String passwordInConfig = null;
-    Boolean isClientInstalled = false;
-    List<Stage> stages = actionDB.getAllStages(requestId);
-    for (Stage s : stages) {
-      for (HostRoleCommand hrc : s.getOrderedHostRoleCommands()) {
-        if (hrc.getRole().equals(Role.HIVE_CLIENT)) {
-          isClientInstalled = true;
-          Map<String, String> hiveSite = hrc.getExecutionCommandWrapper()
-            .getExecutionCommand().getConfigurations().get("hive-site");
-          Assert.assertNotNull(hiveSite);
-          Assert.assertEquals("b", hiveSite.get("a"));
-          passwordInConfig = hiveSite.get(Configuration
-            .HIVE_METASTORE_PASSWORD_PROPERTY);
-        }
-      }
-    }
-    Assert.assertTrue("HIVE_CLIENT must be installed", isClientInstalled);
-    Assert.assertNull(passwordInConfig);
-  }
-
-  @Test
   public void testDecommissonDatanodeAction() throws Exception {
     String clusterName = "foo1";
     createCluster(clusterName);