You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2015/07/27 12:21:54 UTC
ambari git commit: AMBARI-12547. There is no easy way to start all
host components on a host via the API.(vbrodetskyi)
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 <vb...@hortonworks.com>
Authored: Mon Jul 27 13:20:11 2015 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
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.<String, String>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));