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 99DAB17278 for ; Mon, 27 Jul 2015 10:22:10 +0000 (UTC) Received: (qmail 82809 invoked by uid 500); 27 Jul 2015 10:21:54 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 82778 invoked by uid 500); 27 Jul 2015 10:21:54 -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 82769 invoked by uid 99); 27 Jul 2015 10:21:54 -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, 27 Jul 2015 10:21:54 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 65F0DE01FB; Mon, 27 Jul 2015 10:21:54 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vbrodetskyi@apache.org To: commits@ambari.apache.org Message-Id: <77c502db23b14d37afe709363fb94537@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-12547. There is no easy way to start all host components on a host via the API.(vbrodetskyi) Date: Mon, 27 Jul 2015 10:21:54 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/trunk 819ab1049 -> 01054f76d AMBARI-12547. There is no easy way to start all host components on a host via the API.(vbrodetskyi) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/01054f76 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/01054f76 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/01054f76 Branch: refs/heads/trunk Commit: 01054f76df4fafc44cfb1b326e74f7d645a2788f Parents: 819ab10 Author: Vitaly Brodetskyi Authored: Mon Jul 27 13:20:11 2015 +0300 Committer: Vitaly Brodetskyi Committed: Mon Jul 27 13:21:38 2015 +0300 ---------------------------------------------------------------------- .../controller/internal/HostComponentResourceProvider.java | 8 ++++++++ .../server/controller/AmbariManagementControllerTest.java | 4 ++-- .../internal/HostComponentResourceProviderTest.java | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/01054f76/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java index d7fc33b..af39076 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java @@ -554,6 +554,14 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro continue; } + // STARTED state is invalid for the client component, but this shouldn't cancel the whole stage + if (sc.isClientComponent() && newState == State.STARTED && + !requestProperties.containsKey(sch.getServiceComponentName().toLowerCase())) { + ignoredScHosts.add(sch); + logComponentInfo("Ignoring ServiceComponentHost", request, sch.getState(), newState); + continue; + } + if (sc.isClientComponent() && !newState.isValidClientComponentState()) { throw new IllegalArgumentException("Invalid desired state for a client" http://git-wip-us.apache.org/repos/asf/ambari/blob/01054f76/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 46dbb8e..599a1f7 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 @@ -3723,9 +3723,9 @@ public class AmbariManagementControllerTest { reqs.add(req4); reqs.add(req5); updateHostComponents(reqs, Collections.emptyMap(), true); - fail("Expected failure for invalid states"); + // Expected, now client components with STARTED status will be ignored } catch (Exception e) { - // Expected + fail("Failure for invalid states"); } reqs.clear(); http://git-wip-us.apache.org/repos/asf/ambari/blob/01054f76/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java index c38b142..734bbc4 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java @@ -450,6 +450,7 @@ public class HostComponentResourceProviderTest { new TestHostComponentResourceProvider(PropertyHelper.getPropertyIds(type), PropertyHelper.getKeyPropertyIds(type), controller, injector); + provider.setFieldValue("maintenanceStateHelper", injector.getInstance(MaintenanceStateHelper.class)); provider.setFieldValue("hostVersionDAO", injector.getInstance(HostVersionDAO.class));