Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1260417453 for ; Mon, 26 Jan 2015 14:44:24 +0000 (UTC) Received: (qmail 30816 invoked by uid 500); 26 Jan 2015 14:44:24 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 30785 invoked by uid 500); 26 Jan 2015 14:44:24 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 30776 invoked by uid 99); 26 Jan 2015 14:44:24 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jan 2015 14:44:24 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A770EE03F2; Mon, 26 Jan 2015 14:44:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aonishuk@apache.org To: commits@ambari.apache.org Message-Id: <9ac757e5c7394796b8a0a8762d42d79d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-9249. Downloads configuration files have not same values that files at nodes. (aonishuk) Date: Mon, 26 Jan 2015 14:44:23 +0000 (UTC) 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 Authored: Mon Jan 26 16:44:15 2015 +0200 Committer: Andrew Onishuk 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 stages = new ArrayList(); - 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 hiveSite = new TreeMap(); + hiveSite.put("javax.jdo.option.ConnectionPassword", "password"); + hiveSite.put("hive.server2.thrift.port", "10000"); + Map> configurations = + new TreeMap>(); + 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 configs = new HashMap(); - 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 stages = actionDB.getAllStages(requestId); - for (Stage s : stages) { - for (HostRoleCommand hrc : s.getOrderedHostRoleCommands()) { - if (hrc.getRole().equals(Role.HIVE_CLIENT)) { - isClientInstalled = true; - Map 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);